Where is the list of predefined Maven properties
MavenMaven Problem Overview
I know there is a list of all predefined Maven properties (you know like project.build.sourceEncoding
, or project.build.sourceDirectory
). I once saw the list but I just can't find it again.
Maven Solutions
Solution 1 - Maven
Do you mean this one?
I also moved its content to a GitHub repo:
https://github.com/cko/predefined_maven_properties/blob/master/README.md
Solution 2 - Maven
Take a look at [section 9.2.: Maven Properties][1] of the free online book [Maven: The Complete Reference][2].
[1]: http://books.sonatype.com/mvnref-book/reference/resource-filtering-sect-properties.html "section 9.2.: Maven Properties" [2]: http://books.sonatype.com/mvnref-book/reference/index.html "Maven: The Complete Reference"
Solution 3 - Maven
Looking at the "effective POM" will probably help too. For instance, if you wanted to know what the path is for ${project.build.sourceDirectory}
you would find the related XML in the effective POM, such as:
<project>
<build>
<sourceDirectory>/my/path</sourceDirectory>
Also helpful - you can do a real time evaluation of properties via the command line execution of mvn help:evaluate
while in the same dir as the POM.
Solution 4 - Maven
I think the best place to look is the Super POM.
As an example, at the time of writing, the linked reference shows some of the properties between lines 32 - 48.
The interpretation of this is to follow the XPath as a .
delimited property.
So, for example:
${project.build.testOutputDirectory}
== ${project.build.directory}/test-classes
And:
${project.build.directory}
== ${project.basedir}/target
Thus combining them, we find:
${project.build.testOutputDirectory}
== ${project.basedir}/target/test-classes
(To reference the resources directory(s), see this stackoverflow question)
<project>
<modelVersion>4.0.0</modelVersion>
.
.
.
<build>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
.
.
.
</build>
.
.
.
</project>
Solution 5 - Maven
I got tired of seeing this page with its by-now stale references to defunct Codehaus pages so I asked on the Maven Users mailing list and got some more up-to-date answers.
I would say that the best (and most authoritative) answer contained in my link above is the one contributed by Hervé BOUTEMY:
> here is the core reference: > http://maven.apache.org/ref/3-LATEST/maven-model-builder/ > > it does not explain everyting that can be found in POM or in settings, > since there are so much info available but it points to POM and > settings descriptors and explains everything that is not POM or > settings
Solution 6 - Maven
This link shows how to list all the active properties: http://skillshared.blogspot.co.uk/2012/11/how-to-list-down-all-maven-available.html
In summary, add the following plugin definition to your POM, then run mvn install
:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<echoproperties />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>