Maven - Productivity Tips

This collection of Maven tips is mainly for self reference but maybe useful for others.

Download sources and documentation

Download sources of dependencies:

$ mvn dependency:sources

Download Javadoc documentation of dependencies:

$ mvn dependency:resolve -Dclassifier=javadoc

Skipping tests

Skip running tests:

$ mvn clean verify -DskipTests

Skip compilation and running tests:

$ mvn clean verify -Dmaven.test.skip

Run specific tests

All tests in a class:

$ mvn clean verify -Dtest=MyTestClass

Individual tests:

$ mvn clean verify -Dtest=MyTestClass#testMethod

Debugging

Debug unit tests:

$ mvn clean verify -Dmaven.surefire.debug

Debug integration tests:

$ mvn clean verify -Dmaven.failsafe.debug

Debug plugins:

$ mvnDebug clean verify

Resume build from a failed module

When a multi-module build fails you don't have to rebuild everything. Continue with the failing module:

$ mvn clean verify -rf :failed-module

Useful Maven resources