1

The versions-maven-plugin versions:set goal show that there is a removeSnapshot parameter:

removeSnapshot: Whether to remove -SNAPSHOT from the existing version. If not set will default to false.

Type: boolean
Since: 2.10
Required: No
User Property: removeSnapshot
Default: false

I have a Maven multi-module aggregation POM with all the versions in all the modules set to 0.2.0-SNAPSHOT. I am ready to release (please don't tell me to use the Maven release plugin) and I want to change the version to 0.2.0. So I try this:

mvn versions:set -DremoveSnapshot=true

Maven stops and asks me:

Enter the new version to set 0.2.0-SNAPSHOT:

Um, if I manually enter 0.2.0, what's the point of having indicated removeSnapshot=true?

Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
  • I can't reproduce that, on a project without modules (didn't test with, but that shouldn't matter), using version 2.3 of the plugin. Can you post the entire logs of the plugin execution? – Tunaki Dec 16 '16 at 17:13
  • @Garret seems to be working fine with [2.5.3](https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin/2.5.3) as well for multimodule project. Or if you can share further details. – Naman Dec 16 '16 at 17:18
  • 1
    @nullpointer What part of "please don't tell me to use the Maven release plugin" did you not understand? :D hehe I think you're talking about a different plugin. – Garret Wilson Dec 16 '16 at 17:48
  • ya my bad, [2.3](https://mvnrepository.com/artifact/org.codehaus.mojo/versions-maven-plugin/2.3) it is :P – Naman Dec 16 '16 at 18:01
  • Were you able to fix this issue? – Nihal Harish Mar 22 '19 at 21:42

1 Answers1

0

The version 2.3 of versions-maven-plugin, works fine for me while using

mvn versions:set -DremoveSnapshot=true

Also, though couldn't find it documented anywhere but testing the behavior while using

<configuration>
      <removeSnapshot>true</removeSnapshot>
</configuration>

Or

mvn versions:set -DremoveSnapshot=true

I can say that if you try to set your new version from an existing 0.2.0-SNAPSHOT to another 0.2.1-SNAPSHOT or bump(0.2.1) up the version to something else. The parameter would restrict you to simply marking a release of the current SNAPSHOT version resulting in 0.2.0 anyhow.


So (with configuration for removeSnapshot marked as true)

mvn versions:set -DnewVersion=0.2.1

or

mvn versions:set -DnewVersion=0.2.1-SNAPSHOT

would result in generating

<version>0.2.0</version>

On the other hand be it default or explicitly set to false above commands would generate

<version>0.2.1</version> 

and

<version>0.2.1-SNAPSHOT</version>

respectively.

Naman
  • 27,789
  • 26
  • 218
  • 353