Maven Help Command
When we are struck with some aspect of Maven, Plugin’s Help goal and Maven Help Plugin comes handy to navigate output of the situation.
Here we present some the useful Maven help commands as reference.
Find Plugin Prefix
In almost all Maven plugin related commands we need to use Plugin Prefix. We can find plugin prefixes in Maven Plugin Directory. The first column of the table contains the Plugin Prefixes.
For plugins not listed there, use help:describe to show the prefix.
$ mvn help:describe -DgroupId=<group-id> -DartifactId=<artifact-id>
## examples
$ mvn help:describe -DgroupId=org.mortbay.jetty -DartifactId=jetty-maven-plugin
$ mvn help:describe -DgroupId=org.codehaus.mojo -DartifactId=aspectj-maven-plugin
List Plugin Goals
The easiest way to list the plugin goal is plugins help goal.
$ mvn <plugin-prefix>:help
## examples
$ mvn compiler:help
$ mvn surefire:help
$ mvn jar:help
List Parameters of a Goal
To list parameters of a goal, invoke plugin’s help goal with -Dgoal=<goal name> and -Ddetail.
$ mvn <plugin-prefix>:help -Dgoal=<goal name> -Ddetail
## examples
$ mvn compiler:help -Dgoal=compile -Ddetail
$ mvn surefire:help -Dgoal=test -Ddetail
List Parameters with default values
Some of the plugins, show default values for the parameter with plugins help.
$ mvn <plugin-prefix>:help -Dgoal=<goal-name> -Ddetail
## examples
$ mvn jar:help -Dgoal=jar -Ddetail
However, help:describe shows default parameter values for all plugins.
mvn help:describe -Dplugin=<plugin-prefix> -Dmojo=<goal-name> -Ddetail
## examples
mvn help:describe -Dplugin=jar -Dmojo=jar -Ddetail
Important
To pass goal name as parameter, in plugin’s help use -Dgoal and in help:describe use -Dmojo.
List Lifecycle Phases
To know the lifecycle phases and the binded goals use following command.
$ mvn help:describe -Dcmd=<lifecycle-phase-name>
## examples
$ mvn help:describe -Dcmd=compile
$ mvn help:describe -Dcmd=clean
Effective POM
To output effective POM, use following command.
$ mvn help:effective-pom
## to output to file
$ mvn help:effective-pom -Doutput=<file-name>