Maven Versions Plugin: versions:use-releases does nothing
Asked Answered
P

1

6

I need change all snapshots dependency of my project before pass to release. I'm trying versions:use-releases from commandline mvn versions:use-releases, but it doesn't work for me. I'm using Nexus repository for releases and the releases versions are deployed correcly and with public access

<dependencyManagement>  
 <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.efx.util</groupId>
      <artifactId>efx-util</artifactId> 
      <version>0.0.1-SNAPSHOT</version>
    </dependency>
  </dependencies>
</dependencyManagement>

When I execute: mvn versions:use-releases, it does nothing.

[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket-api 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket-api ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket-impl 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket-impl ---
[INFO] Ignoring reactor dependency: com.efx.clientesocket:efx-clientesocket-api:jar:0.0.1-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket-conf 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket-conf ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] efx-clientesocket .................................. SUCCESS [  1.539 s]
[INFO] efx-clientesocket-api .............................. SUCCESS [  0.031 s]
[INFO] efx-clientesocket-impl ............................. SUCCESS [  0.016 s]
[INFO] efx-clientesocket-conf ............................. SUCCESS [  0.015 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

However versions:display-dependency-updates detect the corresponding release

 ------------------------------------------------------------------------
[INFO] Building efx-clientesocket-conf 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:display-dependency-updates (default-cli) @ efx-clientesocket-conf ---
[INFO] artifact junit:junit: checking for updates from nexus
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO]   com.efx.util:efx-util ................ 0.0.1-SNAPSHOT -> 1.0.0-RELEASE
[INFO]   junit:junit ............................................. 4.11 -> 4.12
[INFO]
[INFO] ------------------------------------------------------------------------

And I'm also trying versions:use-last-releases as alternative and it goes OK. I'm using -Dincludes= in this case to avoid updating no-snapshot versions. But, I would like to use versions:use-releases to assure updating only all-snapshot versions and cover versions in property at once

Maven version I'm using is 3.3.1 the plugin version is 2.2

Someone have any idea why does not working??

Pismire answered 4/5, 2016 at 8:41 Comment(0)
T
3

1- versions:use-releases searches the pom for all -SNAPSHOT versions which have been released and replaces them with the corresponding release version.

com.efx.util:efx-util ................ 0.0.1-SNAPSHOT -> 1.0.0-RELEASE 

This means efx-util-0.0.1-SNAPSHOT should have a corresponding Release efx-util-0.0.1-RELEASE or efx-util-0.0.1 (a released version of 0.0.1) otherwise it won't work. 1.0.0-RELEASE is not a corresponding release

2- versions:use-latest-releases searches the pom for all non-SNAPSHOT versions which have been a newer release and replaces them with the latest release version.

In this case it's not restricted to the corresponding release of (0.0.1-SNAPSHOT). So the release may have a different version number (1.0.0-RELEASE).

hope this helps.

Treacle answered 4/5, 2016 at 11:4 Comment(1)
Yes! this help me. Thanks a lotPismire

© 2022 - 2024 — McMap. All rights reserved.