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.

Properties Reference

In Maven, properties are used to customise the behaviour of Maven and its plugins.

Property Processing

Maven supports a hierarchy of different properties to allow specifying defaults and overriding them at the appropriate level.

The properties files in Maven are processed in the following order:

  1. Built-in properties are processed
  2. ${basedir}/project.properties (basedir is replaced by the directory where the project.xml file in use resides)
  3. ${basedir}/build.properties
  4. ${user.home}/build.properties
  5. System properties

The built-in properties are specified in the plugin.properties file of a plugin, or in defaults.properties within Maven itself.

Both the project.properties and build.properties files in the project directory are also inherited along with the related project.xml file.

The last definition takes precedence, so ${user.home}/build.properties will override anything specified in a project, and properties given on the command line using -D will override everything.

Note: there are no per-user defaults, as there has not been a property shown where this concept makes sense. Currently, there are also no site-wide defaults, however this is planned for future versions of Maven.

The following table explains how each file should be used.

${basedir}/project.properties These are properties specific to the project and can be used to set the values for plugin and Maven properties that are appropriate for that project. This file should be checked into your source repository and distributed.
${basedir}/build.properties These are properties specific to the project, but also the user running it. It is for overriding values in the project.properties for this user only. It should not be checked into the source repository. If a user is required to set any of these properties for a build to run properly, a build.properties.sample file should be created and checked into the source repository as a courtesy.
${user.home}/build.properties These are properties specific to the user but shared among all projects. This typically specifies remote repositories to download from and upload to, proxy settings, file system locations, and so on.

Built-in Maven Properties

The following properties are built-in to Maven and apply to all projects.

Maven Configuration Properties

Property Description Default Value
maven.home.local The directory on the local machine Maven uses to write user specific details to, such as expanded plugins and cache data. ${user.home}/.maven
maven.plugin.dir Where Maven can find it's plugins. ${maven.home}/plugins
maven.plugin.user.dir Where Maven can find plugins for this user only. ${maven.home.local}/plugins
maven.plugin.unpacked.dir Where Maven expands installed plugins for processing. ${maven.home.local}/cache
maven.repo.local The repository on the local machine Maven should use to store downloaded artifacts (jars etc). ${maven.home.local}/repository

Build Structure Properties

Property Description Default Value
basedir This is the base directory of the currently building project. It is an absolute path. -
maven.build.dir The directory where generated output, e.g. class files, documentation, unit test reports etc goes. ${basedir}/target
maven.build.dest The directory where generated classes go. ${maven.build.dir}/classes
maven.build.src The directory where generated source goes. DEPRECATED: Currently unused. There is no replacement - any plugin generating source has it's own specific property. ${maven.build.dir}/src
maven.conf.dir The directory that holds configuration files. DEPRECATED: Currently unused. Instead, use the <resources> element of the POM. ${basedir}/conf
maven.src.dir The base directory for source code. Note that this should contain all source directories (<sourceDirectory>, <unitTestSourceDirectory>, etc.) defined in the POM. ${basedir}/src

Documentation Properties

Property Description Default Value
maven.docs.dest The output directory for the generated HTML for the site documentation. ${maven.build.dir}/docs
maven.docs.omitXmlDeclaration Whether generated documentation should have an xml declaration, e.g.
<?xml version="1.0"?>
maven.docs.outputencoding The character encoding for generated documentation. ISO-8859-1
maven.docs.src The directory for user supplied documentation. ${basedir}/xdocs
maven.gen.docs The directory where generated xdocs that need to be transformed to HTML are placed. ${maven.build.dir}/generated-xdocs

Connection Properties

Please refer to Working with Repositories for more information.

Property Description Default Value
maven.mode.online Whether you are connected to the internet or not. true
maven.repo.remote The repository maven should use to download artifacts (jars etc) that it can't find in the local repository. You should set this to one of the repo mirrors. You can also specify multiple repositories, separated by commas. http://repo1.maven.org/maven/
maven.repo.remote.enabled Whether or not a remote repository should be used. true

Proxy Properties

If you do require a proxy, the most appropriate place to set these values would be in your ${user.home}/build.properties file.

Property Description Default Value
maven.proxy.host The IP or address of your proxy. -
maven.proxy.port The port number of your proxy. -
maven.proxy.username User name if your proxy requires authentication. -
maven.proxy.password Password if your proxy requires authentication. -
maven.proxy.ntlm.host The host to use if you are using NTLM authentication. -
maven.proxy.ntlm.domain The NT domain to use if you are using NTLM authentication. -

Deployment Properties

DEPRECATED: The following have all been deprecated in favour of using the relevant elements in the POM, and the properties of the artifact plugin.

Property Description Default Value
maven.repo.central This is the host that Maven will attempt to deploy to. This is deprecated in favour of distributionSite and siteAddress. -
maven.repo.central.directory This is the directory that Maven will attempt to deploy to. This is deprecated in favour of distributionDirectory and siteDirectory. -
maven.scp.executable The executable to use for secure copies. scp
maven.ssh.executable The executable to use for executing commands remotely. ssh
maven.username The remote username to log in as when deploying. -
maven.remote.group The group to set the artifact to once deployed. maven

Built-in Plugin Properties

Each plugin has a set of built in properties. For a reference of these properties, you can find a "Properties" link in the left hand navigation of the plugin documentation of each individual plugin.