<sourceDirectory>${basedir}/src</sourceDirectory> <outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory>
Available Variables
Project Model Variables
Any field of the model that is a single value element can be referenced as a variable. For example, ${project.groupId}, ${project.version}, ${project.build.sourceDirectory} and so on. Refer to the POM reference to see a full list of properties.
These variables are all referenced by the prefix "project.". You may also see references with pom. as the prefix, or the prefix omitted entirely - these forms are now deprecated and should not be used.
Special Variables
basedir | The directory that the current project resides in. |
project.baseUri | The directory that the current project resides in, represented as an URI. Since Maven 2.1.0 |
maven.build.timestamp | The timestamp that denotes the start of the build. Since Maven 2.1.0-M1 |
The format of the build timestamp can be customized by declaring the property maven.build.timestamp.format as shown in the example below:
<project> ... <properties> <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format> </properties> ... </project>
The format pattern has to comply with the rules given in the API documentation for SimpleDateFormat. If the property is not present, the format defaults to the value already given in the example.
Properties
You are also able to reference any properties defined in the project as a variable. Consider the following example:
<project> ... <properties> <mavenVersion>2.1</mavenVersion> </properties> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-artifact</artifactId> <version>${mavenVersion}</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-project</artifactId> <version>${mavenVersion}</version> </dependency> </dependencies> ... </project>