Maven versions plugin update to next snapshot
Asked Answered
K

1

6

I'm trying to use the maven versions plugin to update my pom to the next snapshot version. eg. 0.0.1 should change to 0.0.2-SNAPSHOT.

From my reading of http://www.mojohaus.org/versions-maven-plugin/set-mojo.html I would expect mvn versions:set -DnextSnapshot=true to do this, but in reality it just prompts me for a new version with a default of the current version (0.0.1). Am I missing something here? I want to do this update as a part of a script so don't want any manual intervention.

I'm using v2.5 of the versions plugins. That link above says that nextSnapshot is available from 2.10 but 2.5 seems to be the latest I can find.

Keelung answered 24/10, 2017 at 16:44 Comment(1)
U
7

I also faced this issue. I got to know that my Maven project was picking up older version (2.3) of Versions Plugin. This no longer seems to be a problem in latest version (2.7) of the plugin.

I added following in pom.xml of my project to force my project use 2.7 version of Maven Versions plugin.

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>versions-maven-plugin</artifactId>
      <version>2.7</version>
    </plugin>       
  </plugins>
</pluginManagement>

Otherwise, you can mention latest version of Versions plugin to choose in command line :- mvn org.codehaus.mojo:versions-maven-plugin:2.7:set -DnextSnapshot=true

Underhill answered 5/1, 2019 at 14:17 Comment(1)
I think the name is versions-maven-plugin: search.maven.org/…Kab

© 2022 - 2024 — McMap. All rights reserved.