Using Maven 3.0.4.
I have been tasked with providing the corporate parent POM for our organization. My team will support questions or concerns that developers have when using this POM. Often they attach a build log to a support ticket. So, I want my corporate POM to replicate the corporate parent version to the console with any assembly. I use the antrun plugin for this.
<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>echo-build-environment</id> <phase>validate</phase> <goals><goal>run</goal></goals> <configuration> <target> <echo level="info" message="Maven ${maven.version}" taskname="Version" /> <echo level="info" message="Corporate POMs ${want.the.version.here}" taskname="Version" /> .... </target>
Trick, I donβt know how many βlevelsβ of POM inheritance can occur between the corporate parent and the POM used in the assembly. We could have an inheritance structure something like this:
corporate-parent team-parent application-parent child-module
Or simply:
corporate-parent a-simple-library
I can not answer ${project.version} , because it will be a version of the current (child) project. I cannot use ${project.parent.version} because I have no idea how many levels of inheritance there can be. I tried to define the <corporate.pom.version> property, hard-coded for the corporate version of POM, however, when I release my corporate POM, the release plugin does not know to update this property (which makes sense, this is not a dependency version, it's just a property version of the version can not know to update it).
Ideally, I would like to get the version of a specific POM directly through a property, something like ${some.groupId.corporate-parent.version} . Is there anything similar?
If not, is there a way during release to update the POM property with releaseVersion released project?
I could go back to the rough way of manually editing a property before each version. My teammates would not appreciate this approach.
I hope that I do not need to write a custom plugin to do something that at first glance did not seem complicated.