Useful Maven Commands

Maven has the ability to customize a build through system properties provided in the command line. These properties can come from many places such as:

  • <properties> element in pom.xml
  • <properties> element in a profile in pom.xml
  • <properties> element in a profile in a settings.xml file
  • Configuration expressions of a maven plugin.

In the case of the <properties> element these properties can in turn be used as configuration values of maven plugins. This gives some very powerful capabilities regarding build configuration. However, if one doesn't fully understand how Maven works and the build configuration for a project it can be difficult to know what system properties can be specified on the command line. This document is an attempt to put into one place many of the more useful command line properties. Including both plugin expressions and common properties provided as part of a Stack project template.

Useful Plugin Expressions

Every thing Maven does is done through plugins. Plugin configuration is sometimes masked by first class pom configuration but all build logic eventually comes down to a plugin. If you can find the maven site documentation for a maven plugin then you should be able to find the "Plugin Documentation" for that plugin. This is the configuration reference manual for a plugin. It generally includes all "goals" that can be executed by this plugin and all configuration parameters this plugin will accept. If you look at the "parameter details" of a parameter for most parameters you will see an "Expression:" associated with that parameter. Often times these expressions can be overridden be set on the commandline by supplying a system property using the "-D" argument. For example:

mvn clean install -Dmaven.test.skip=true

In this case if you look at the maven surefile documentation for the skip parameter. You will notice its expression is "${maven.test.skip}". So by supplying this system property we are overriding the value of this expression. You can also override a plugin parameter by supplying a maven property using the <properties> element by using the same name. For example:


If this configuration existed in in a pom.xml or an active profile then this project and all of its child modules would skip all their tests. Properties specified in this way can still be overridden using a command line system property argument.

This section contains several useful plugin parameter expressions that can be overrode as well as links to the plugins documentation.

Expression Description Documentation
maven.test.skip Will skip the complication and the execution of all test both unit and integration for an application. Maven Surefire Plugin
maven.javadoc.skip Will skip the generation and packaging of the javadoc jar. Maven JavaDoc Plugin
source.skip Will Skip the packaging of source jars for the project. Maven Source Plugin
skipTests=true Will skip the execution but not the complication of all unit tests in an application. Maven Surefire Plugin
skipITs=true Will skip the execution but not the complication of all integration tests in an application. Maven Failsafe Plugin
groups={TestNG Group Name(s)} Specifies what TestNG group of unit tests will be executed this build. If no group is specified then all unit test will be executed. Maven Surefire Plugin
itGroups={TestNG Group Name(s)} In some rare situations the Stack will override a default maven plugin property in stack-master. Usually because the default parameter expression isn't unique enough for our purposes. In this case the maven surefire and failsafe plugins specify the same default expression for their groups. So we have change the default configuration in stack-master of the failsafe plugin to use the "itGroups" parameter for specifying the TestNG groups of integration tests to execute. If no value is specified the default is to execute all integration tests. Stack Master
db.configurationFile={} Will override the default db migration tool properties file used. Stack DB Migrator Plugin
db.skipDBTool=true Will entirely skip the execution of the DB Migration tool. Stack DB Migrator Plugin
* There are numerous properties useful in overriding as part of a Tomcat, Tcat, Was, or WAM deploy. So, rather than re document them, here are the links to their respective plugin documentation pages. Tomcat Deploy Plugin,
Tcat Deploy Plugin,
WAS Deploy Plugin,
WAM Maven Plugin

Stack Template Properties

If you created your project from using Stack Starter then your project came configured with some preexisting properties. These properties are mostly used to help unify configuration of deployment locations and such. As well as properties to help the application function one way when executed on a developer box vs. another way when executed as part of a continuous build. In this section we'll attempt to document some of these default properties. Note however that these properties frequently change as stack project templates evolves. This document will reflect the latest version of the templates. If your project was created from an earlier template it may not have all the same properties documented here. It is always best to examine your project's configuration files yourself and understand from them how your project's build is configured and manipulated.

Property Description
deployHost Represents the host this application and its wam emulator (if applicable) will be deployed to. By default the value is "localhost". But if the continuous build profile is activated the value should be the ip address or host name of your continuous environment server.
deployJavaHomst Represents the java home directory on the environment the application's resources are being deployed to. By default this is blank meaning it will use the JAVA_HOME environment variable and PATH variable on the destination environment.
deployUser Represents the username the deploy plugins should use when deploying to a remote environment as part of the build. This is usually the username of an ssh account on the remote box as most of the deploy plugins in the Stack use ssh+scp.
Represents the url the plugin will hit to determine if an application was successfully deployed. See the applicable plugin documentation for more information.
wamUrl If your application is using WAM and the WAM emulator maven plugin this property specifies the home url of your application. This property is often used in identifying the front door of an application for purposes such as functional tests.
This page was last modified on 12 July 2013, at 18:17.

Note: Content found in this wiki may not always reflect official Church information. See Terms of Use.