Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
outlinetrue
indent20px
stylenone
printablefalse

Introduction

Netbeans is a free, community developed opensource IDE which can be used for programming in a host of languages like Java, C/C++, Ruby, Python. Most developers from the OpenMRS community work on Eclipse IDE, but open-source means you have the choice to use your own tools and this How-To Guide is directed to developers who want to develop OpenMRS using Netbeans IDE.

Tools Required

  1. Netbeans IDE with Web & Java EE Bundle (Tutorial uses v6.1)
  2. SVN client (optional, but recommended for easy checkout and commit of code)
  3. Hibernate Support plugin (optional)
  4. Spring Framework Integration (optional)

...

  • Once you have the source code, you want to create a new project. File>New Project (Ctrl+Shift+N)... and then Webh1. >Web Free-Form Project

Select Source Location

  • Select location of the source folder. Selecting the correct location will automatically fill the other fields in the dialog by parsing through the ant script (build.xml).

Mapping Ant Targets

  • The next screen automatically detects the various targets from the ant script. You can map the IDE functions to targets from the ant script. You can map the functions from the drop-downs like shown in the screenshot below:

Select Web Sources

  • The web sources are automatically selected or you can select as shown in the screenshot

Select Source Files

  • The source packages for OpenMRS are located inside the src\api and src\web whereas the tests are located inside test\api and test\web

Source Classpath

Selecting the Java Sources Classpath is an important step and Netbeans doesn't understand libraries automatically. Thus, each Source Package folder will need the libraries. This can be a long procedure, but editing the *project.xml file inside nbproject folder makes the process less tedious. But we will do this after the project is created. For the time being, just add the libraries to one source package from the dropdown.

...

You have to ensure that each package-root section has the classpath tag like shown above. You can copy paste the same libraries for all the package-root folders.Creating a Module in Netbeansh1. Creating a module for OpenMRS in Netbeans is exactly the same procedure. You have to checkout the module sources and then create a new project. But there is no WEB-INF folder that is required and you can keep it empty when entering it in the wizard. Also, you may want to use the ant script's package-module to be mapped with the IDE's Run operation. This will create an omod file which you can load through the OpenMRS admin page.Tomcat Changes for Working in Netbeans==
Netbeans comes with a built-in Tomcat (or Glassfish). You have to change the OpenMRS Default Properties to tomcat.port = 8084, since the built-in Tomcat uses port 8084 by default.

Using Maven in Netbeans

http://www.netbeans.org/Using Maven in Netbeans IDE