mavenmaven-3pom.xmlmaven-release-pluginversions-maven-plugin

Remove -SNAPSHOT from project version in pom


I have a pom with the following GAV

<groupId>com.company.services</groupId>
<artifactId>test-branch-2</artifactId>
<version>1.0.21-SNAPSHOT</version>

I want to remove -SNAPSHOT from this using maven in batch mode, so I can do it with Jenkins and not have to specify anything manually.

I've looked at the documentation for version:set but all the options offer me an interactive prompt and ask me to type a name for the version.

I would prefer the versions plugin, not the release plugin.


Solution

  • Since version 2.10 of the Versions Maven Plugin you can simply do:

    mvn versions:set -DremoveSnapshot