Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: the code to compile w/o tests

...

Go to the most outer project directory and run:

Code Block

mvn clean install

It will compile, run tests, build all artifacts and install them to your local repo. Built artifacts are located in the target directory of each module (api/web/webapp)

To build the project, but skip running tests (you must run tests when building for the first time in order to create test artifacts):

Code Block

mvn clean install -DskipTestsDmaven.test.skip=true

To run individual tests:

Code Block

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:

Wiki Markup
{pre}mvn test \-Dtest=ConceptTest{pre}

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

Code Block

mvn jetty:run

Open the Internet browser and go to http://localhost:8080/openmrs

...

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.

Code Block

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

Generate HTML Junit Report

Code Block

mvn surefire-report:report

...

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

Code Block

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

Code Block

mvn javadoc:aggregate-jar

...

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

Code Block

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

Increasing memory for Maven

  • In Linux: Add a file called ".mavenrc" to your home directory with this content:

    No Format
    MAVEN_OPTS="$MAVEN_OPTS -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m"
  • In Windows: Add a new environment variable called MAVEN_OPTSand set it to

    No Format
    -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m
  • In Eclipse: Within the relevant Run Configuration, select the JRE tab and set the VM Argumentsto

    No Format
    -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

...