Maven - useful tips and tricks


Here are some commands and settings which you may find useful when working with Maven.

  • Installing third party JAR artifacts into the local repository

mvn install:install-file -Dfile=<path_to_jar> -DgroupId=<groupid> -DartifactId=<artifactid> -Dversion=<version> -Dpackaging=<packaging>

  • Running build in the offline mode: mvn clean install -o
  • Copy all project dependencies to the folder target/dependencies:
mvn dependency:copy-dependencies

Note: you may actually only be interested in the 'runtime' dependencies:
mvn dependency:copy-dependencies -DincludeScope=runtime

  • Delete / purge the existing dependencies and download again:
mvn dependency:purge-local-repository

  • Check for newer versions of project dependencies and plugins:

mvn versions:display-dependency-updates
mvn versions:display-plugin-updates

  • Skipping unit test from the build: mvn clean install -DskipTests=true

Note: you can make it permanent in the POM file configuration:



For more info and guides please visit the official webiste:

No comments:

Post a Comment