You are previewing Maven: The Definitive Guide.

Maven: The Definitive Guide

Cover of Maven: The Definitive Guide by Sonatype Company Published by O'Reilly Media, Inc.
O'Reilly logo

Maven Properties

You can use Maven properties in a pom.xml file or in any resource that is being processed by the Maven Resource plugin’s filtering features. A property is always surrounded by ${ and }. For example, to reference the project.version property, one would write:


Some implicit properties are available in any Maven project, namely:


Maven Project Object Model. You can use the project.* prefix to reference values in a Maven POM.


Maven settings. You use the settings.* prefix to reference values from your Maven settings in ~/.m2/settings.xml.


Environment variables such as PATH and M2_HOME can be referenced using the env.* prefix.

System properties

Any property that can be retrieved from the System.getProperty() method can be referenced as a Maven property.

In addition to these implicit properties, a Maven POM, Maven settings, or a Maven profile can define a set of arbitrary, user-defined properties. The following sections provide more detail on the various properties available in a Maven project.

Maven Project Properties

When a Maven Project Property is referenced, the property name is referencing a property of the Maven Project Object Model. Specifically, you are referencing a property of the org.apache.maven.model.Model class that is being exposed as the implicit variable project. When you reference a property using this implicit variable, you are using simple dot notation to reference a bean property of the Model object. For example, when ...

The best content for your career. Discover unlimited learning on demand for around $1/day.