...
- Using the M2Eclipse Maven Plugin in Eclipse
- Using the Maven plugin for Eclipse
- Using Maven In Intellij IDEA
- Using Maven In Netbeans
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.
...
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:
Pre |
---|
mvn test -Dtest=ConceptTest |
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
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.
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
...