Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

Configuration

These pages describes how to use the popular Maven with the most common Java IDEs

For groups of developers working on limited internet connections it may be worth setting up a Maven proxy to reduce the amount of traffic required for Maven development. See Setting up a Maven proxy server for instructions on setting up the Nexus proxy server.

Common Maven Commands

List of common commands for working with the Maven OpenMRS branch: Maven Branch Except for the Jetty command, all commands are expected to be run from the root of the checked out project.

Maven can be downloaded here: http://maven.apache.org/download.html

Build Project and Run All Tests

Builds all artifacts, installs artifacts to local repo, and runs tests. Built artifacts are located in the target directory of each module (api/web/webapp)

mvn clean install

Build Project and skip running tests:

mvn clean install -DskipTests

Run individual tests:

mvn test -Dtest=Classname

This will run the tests from Classname. So to run tests from ConceptTest, you need to go to api folder and type:

mvn test -Dtest=ConceptTest

Generate HTML Junit Report

mvn surefire-report:report

The html output will be in: target/site/surefire-report.html

Generate Javadocs in Jar

Generates Javadoc html for each module in target/apidocs and packages to target/<artifact>-<VERSION>-javadoc.jar. For more details, see the Maven Javadoc Plugin

mvn javadoc:jar

Generates Javadoc html for entire project in target/apidocs and packages to target/openmrs-<VERSION>-javadoc.jar. For more details, see the Maven Javadoc Plugin

mvn javadoc:aggregate-jar

Compile and Start Jetty for hot deployment

Must be run from the webapp directory. Starts up Jetty and deploys OpenMRS.
Requires increasing memory for Maven

mvn jetty:run

Compile and Start Jetty for hot deployment with JRebel

Must be run from the webapp directory. Starts up Jetty and deploys OpenMRS with JRebel to allow on-the-fly class and web resource reloading.
Warning: this does not work perfectly at the moment - please report any issues on the JRebel Support Forum.
Requires increasing memory for Maven

For working only with trunk, no file editing is necessary. For working with trunk and one or more module(s), please first edit webapp/pom.xml. Search for the string JRebel, and follow instructions regarding relevant modifications that must be done for working with JRebel and one or more modules.

export MAVEN_OPTS="-noverify -javaagent:PATHTOJREBELJAR/jrebel.jar"
mvn jetty:run -P jrebel

Branching and Releasing

Creates a branch based on trunk. Also allows incrementing trunk version to next SNAPSHOT version. For more details, see the Maven Release Plugin

mvn release:branch -DbranchName= -Dusername= -Dpassword=

Increasing memory for Maven

  • In Linux: Add a file called ".mavenrc" to your home directory with this content:
    MAVEN_OPTS="$MAVEN_OPTS -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m"
  • In Windows: Add a new environment variable called MAVEN_OPTS and set it to
    -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m
  • In Eclipse: Within the relevant Run Configuration, select the JRE tab and set the VM Arguments to
    -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

By setting MAVEN_OPTS as an environment variable, the options specified will be applied to all Maven executions. However, this can be overridden by each project by specifying the parameters at the command line (or in the Eclipse Run Configuration).

  • No labels