Remove -SNAPSHOT from project version in pom

Jepper picture Jepper · May 6, 2014 · Viewed 25.1k times · Source

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.

Answer

Rinke picture Rinke · Sep 4, 2017

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

mvn versions:set -DremoveSnapshot