Using Maven in Netbeans

Support for Maven comes built-in with Netbeans for Java. The maven functionality and the different usages of it inside of Netbeans has been described in more detail here: http://platform.netbeans.org/tutorials/nbm-maven-quickstart.html

Activate Features on first startup of Netbeans

Additionally, soon after installing Netbeans, you may need to activate different features on the first startup as shown below: 

Checkout OpenMRS Trunk

Next, is to checkout OpenMRS trunk which is a maven project and has 5 maven modules (openmrs-tools, openmrs-test, openmrs-api, openmrs-web, openmrs-webapp).
     

After, this press the Finish button. This will start checking out the latest code from the OpenMRS trunk (~32MB). On the last screen, if you have check marked the option "Scan for Netbeans Project after Checkout", then at the end it will ask you wish to open the 5 projects that were checked out. Please click on "Open Project" and you will see the projects.

Select OpenMRS and press Open... This opens the main project, inside which you will see the other projects listed as modules. These are the different parts of OpenMRS and depending on which one you are working on, or building, you can run/open the modules further.

You may want to build the openmrs-api and openmrs-web, before building the openmrs-webapp, as it allows to get all the dependencies that are required for OpenMRS into the local maven repository.
   
After getting all the dependencies, Clean and Build the openmrs-api and the openmrs-web modules.
The openmrs-web application can then be tested to build and run on jetty by defining a Goal to run through the jetty:run command. You may also want to skip tests or build offline etc can be configured through this screen.
  

On opening the openmrs-webapp maven module, we can run the web application in one of the supplied application servers (Apache Tomcat or Glassfish) by right-clicking on the project and Run or through the    icon in the toolbar. 

Tips to Skip Tests

If unit tests are taking too long and you want to skip them at times, when you are not running tests specifically.... then you can go to Tools->Options->Miscellaneous->Maven-> Check the "Skip Tests for any build executions not directly related to testing