I need to replace all occurrences of ${project.version}
with the real value in a pom.xml.
I can do that with the maven-flatten-plugin
, but that will rewrite the whole pom.xml instead of just replacing the project.version
only.
As I want to use the jgitver-maven-plugin
I can't use the resolveCiFriendliesOnly
mode of the flatten plugin.
Is there an easy way to replace only one variable in the whole pom.xml? Is there another (hidden) option in the flatten plugin to do this?
You can use the maven release plugin, specifically the update-versions goal.
ex: mvn --batch-mode release:update-versions -DdevelopmentVersion=1.2.0-SNAPSHOT
https://maven.apache.org/maven-release/maven-release-plugin/examples/update-versions.html