Frequently used Maven Command Line Arguments

This is a collection of my personal most used/favorite Maven command line options.

Changing the output e.g. when debugging build/packaging issues: mvn -eX package

short long description
-e --errors Produce execution error messages
-X --debug Produce execution debug output
-q --quiet Quiet output - only show errors

Switch the active profile e.g. for integration testing only mvn -P integration-tests test:

short long description
-P --activate-profiles <arg> Comma-delimited list of profiles to activate

If you ever need to use Maven without having access to a network, you should use the following option to prevent any attempt to check for updates to plugins or dependencies over a network:

short long description
-o --offline Work offline

Sometimes the pom.xml is not inside the root directory of your project...

short long description
-f --file <file> Forces the use of an alternate POM file

Last but not least: A nice option for the Maven Release Plugin

short long description
-B --batch-mode Run in non-interactive (batch) mode

With this option enabled the release plugin will use default values instead of prompting for them interactively.

For complete reference please see Maven Command Line Options.

Show Comments