TODO:
on specific content in mavenSession.getRequest().getGoals() ⇒ we should autoskip the plugin to avoid messing with incompatible goals
Replace the '${revision}' variables in all pom.xml of the MultiModule Maven Project with the real hardcoded version found in the upper pom’s properties/revision node.
For example all child pom’s "${revision}" version in their <parent> declaration will be replaced with the hardcoded "1.2.3-SNAPSHOT" if the upper pom contains:
<properties>
<revision>1.2.3-SNAPSHOT</revision>
...
</properties>
First, in the upper pom, the hardcoded version is transfered into the properties/revision node, overwriting any previous value. So after a Maven release, the properties/revision node will see the correct version again.
Then it replaces the hardcoded version in all the poms (including the upper one) with a "${revision}" variable. In the upper pom.
using CI friendly Maven forces the local dev to always execute from the upper pomso that ${revision} is defined. Otherwise child pom will not know their parent.
So we have to use the --projects feature of Maven from the root if we want to build only a specific child. We can not build directly from its sub-directory.
-
for flatten Mojo, use the same principle as for the unflatten Mojo so that we can have better logs (no saying "Rewriting pom" when in fact the pom is already flattened)
mvn com.teamtter.maven:cifriendly-maven-plugin:1.0.8:unflatten
the library "decentxml" is used to keep pom formatting
To change the version of a CIFriendly multi-module (or single) project, just use:
mvn versions:set-property -DnewVersion=3.0.0-SNAPSHOT -Dproperty=revision