I see in many pom.xml files the use of this property: ${project.artifact.selectedVersion.majorVersion}
such as in:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my_group</groupId>
<artifactId>my_artifact</artifactId>
<packaging>pom</packaging>
<version>1.2.3-SNAPSHOT</version>
<properties>
<ver>${project.artifact.selectedVersion.majorVersion}</ver>
...
This property is not in the standard maven: http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
So, where is this variable defined?
I see that it has the build-helper-maven-plugin plugin: http://mojo.codehaus.org/build-helper-maven-plugin/parse-version-mojo.html
which can parse the variable into majorVersion
and minorVersion
,
but the default defaultPrefix
is parsedVersion.{majorVersion, minorVersion}
,
instead of project.artifact.selectedVersion.{majorVersion, minorVersion}
...
(and the defaultPrefix
is not defined in those pom.xml files that I am looking at)
so, where is the variable ${project.artifact.selectedVersion.majorVersion}
defined?
The thing to do is usually to start from the MavenProject
JavaDocs and click through the property path.
MavenProject
-> .getArtifact()
-> Artifact
-> .getSelectedVersion()
-> ArtifactVersion
-> .getMajorVersion()
For every XML Element in a pom.xml, there is a corresponding JavaBean Property in MavenProject
, and periods delimit paths to properties of properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With