Skip to content

Maven

Basic actions

Builds the project and installs the resulting artifact into the local Maven repository:

mvn install

Clears the target directory and builds the project and installs the resulting artifact into the local Maven repository:

mvn clean install

Clears the target directory, builds the project without running unit tests and installs the resulting artifact into the local Maven repository:

mvn clean install -Dmaven.test.skip=true

Builds the project and packages the resulting JAR file into the target directory:

mvn package

Clears the target directory, builds the project and packages the resulting JAR file into the target directory:

mvn clean package

Clears the target directory, builds the project and packages the resulting JAR file into the target directory without running the unit tests during the build:

mvn clean package -Dmaven.test.skip=true

Test management

Runs all integration tests:

mvn verify

Cleans the target directory and runs all integration tests:

mvn clean verify

Dependency management

Cleans project and copies dependencies from remote Maven repositories to the local Maven repository:

mvn clean dependency:copy-dependencies

Prints out the dependency tree:

mvn dependency:tree -Dverbose

Prints out the classpath needed to run:

mvn dependency:build-classpath

To debug

Get verbose logs (add -X):

mvn -X clean verify

Thanks

Thanks to Jakob Jenkov for his work. Most of the info's on this page come from here