Maven Command Line Cheatsheet

Version 7

    A quick reference to Maven commands.

    mvn -Dtest=<unqualified-classname> test

    Tests only the specified class

     

    mvn -Dmaven.surefire.debug test

    Enables remote debugging of tests on port 5005. Surefire will block on the port until you connect with your debugger.

     

    mvn -Dcargo.wait=true -P int integration-test

    Runs CS in Tomcat via cargo

     

    mvn help:effective-pom

    Shows the logical contents of a pom.xml, including contents inherited from the parent pom.xml, up to and including the Maven super POM.

     

    mvn dependency:tree

    Shows all dependencies (including transitive dependencies) of your project. This is very helpful for debugging dependency version issues.

     

    mvn -X <package-name>

    Shows all explicit and transitive dependencies for a package, helping to identify conflicts

     

     

    mvn dependency:sources

    Downloads all project sources separate from IDE project creation.  Execute from root of parent project, then have your IDE synch up sources.

     

    Not Currently Available to Customers:

     

    mvn -Dupgrade.version=<version you're upgading to> com.jivesoftware.maven:maven-upgrade-plugin:upgrade

    Will generate a list of diff files based on product changes that correspond to your overlays. Also generates a mirrored directory structure with product files that enables you to diff against your project's web directory

     

    Note: requires SVN access; a version is in development to use Maven dependencies instead.

     

    mvn deploy:deploy-file -DgroupId=<package> -DartifactId=<artifact-name> -Dversion=<version-no> -Dpackaging=jar -Dfile=/path/to/file.jar -Durl=http://maven-secure.jiveland.com/archiva/repository/jive.snapshots -DrepositoryId=secure.jive.snapshots

    In this example, the command deploys a jar artifact to our repository.  This command working depends on your having adequate permissions.