I have a pom with the following GAV
com.company.services
test-branch-2
1.0
Add the following to your POM:
org.codehaus.mojo
build-helper-maven-plugin
1.11
newVersion
${project.version}
-SNAPSHOT
false
org.codehaus.mojo
versions-maven-plugin
2.2
You can now remove the -SNAPSHOT
part of your project's version with:
mvn build-helper:regex-property versions:set -N
The -N
tells Maven to only proces the root project in case you have modules defined in your POM. This is not strictly necessary but prevents the build-helper
plugin from running unnecessarily against the submodules. The versions
plugin runs only on the root project in any case, and traverses all modules automatically. Consider using the reactorModuleConvergence
rule of the maven-enforcer
plugin to make sure multi-module projects are handled correctly.
You can run mvn versions:commit
to remove the backup POM(s) generated by versions:set
. Alternatively you can add
to the configuration of the versions
plugin.