Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

Command Line Reference

The following command line options are available when running Maven:

usage: maven [options] [goal [goal2 [goal3] ...]]

 -D,--define arg    Define a system property
 -E,--emacs         Produce logging information without adornments
 -P,--plugin-help   Display help on using a given plugin
 -X,--debug         Produce execution debug output
 -b,--nobanner      Suppress logo banner
 -d,--dir arg       Set effective working directory (ignored with -p or -f)
 -e,--exception     Produce exception stack traces
 -f,--find arg      Set project file and effective working directory by finding
                    the project file
 -g,--goals         Display available goals
 -h,--help          Display help information
 -i,--info          Display system information
 -o,--offline       Build is happening offline
 -p,--pom arg       Set project file
 -q,--quiet         Reduce execution output
 -u,--usage         Display help on using the current project
 -v,--version       Display version information

Typically, Maven is run with a list of goals in the order they should be executed. If no goals are specified, the default goal specified in maven.xml file. Additionally, the following switches can be specified. Note that -P, -g, -h, -i, -u and -v cause Maven to exit immediately without running any goals given.

-D Defines a system property. This will take priority over any other property specified. eg. maven -Dmaven.repo.remote=http://public.planetmirror.com/pub/maven.
-E Output messages without adornments, making it more suitable for use in emacs.
-P Get help with plugins. When used without any arguments, ie. maven -P, all installed plugins are listed with a description. When a plugin name is given, the goals in that plugin are listed. eg. maven -g jar lists the goals such as jar:jar, jar:install, and so on.
-X Output full debugging information while performing the build. This can be helpful in tracing what is happening inside a plugin, or sending information to the Maven Developers about an internal bug.
-b Don't show the ASCII Art banner.
-d Set the effective working directory for running Maven in.
-e Display the stack trace for any final exception that leads to a build failure.
-f Set the effective working directory for running Maven in by searching for the closest project.xml.
-g List all goals available, both in this project and all installed plugins. Best used with grep or a pager such as less.
-h List the help commands above.
-i Show system information. Lists environment properties such as the Java version, all installed plugins and their versions, and the user's build.properties file.
-o Run in offline mode. This is equivalent to specifying the property maven.mode.online=false. Missing dependencies will cause failures, however old SNAPSHOTs will only cause a warning.
-p Specify the project file to use. By default it is project.xml in the current directory.
-q Run in quiet mode. Only errors are output. Note that some plugins do not honour this option, so it should not be considered as a silent mode.
-u Show the usage instructions for the current project. This will include the goals specified in maven.xml, and the instructions listed in the description element of the project.
-v Show the Maven version and exit.


Specify additional options using the MAVEN_OPTS environment variable. It is for passing parameters to the Java VM when running Maven. For example, to increase the amount of memory to 1024 Meg for the entire run of Maven, use:


Also note that a given plug-in may have a property to set for its memory usage, such as the Javadoc plug-in's maven.javadoc.maxmemory property. This is because that particular plugin forks an additional Java VM.

For another example, set the MAVEN_OPTS to run Java in debug mode:

MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y

After setting this property, run "maven cactus:test" (or whatever goal to debug) and it will block, waiting for a debug connection.

Then, in your IDE, select the "Run -> Debug" window and craete a new "Remote Java Application" configuration, passing the port set in MAVEN_OPTS (8787 in this case).

Once running this configuration in debug, the blocked Maven session will continue, enabling debugging from your IDE.