use-latest-version and update-properties find different version
Given following pom snippet:
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
</plugins>
</pluginManagement>
Running `mvn update-properties' result in:
[INFO] --- versions-maven-plugin:2.7:update-properties (default-cli) @ demo-app ---
[INFO] artifact org.springframework.boot:spring-boot-dependencies: checking for updates from local-nexus
[INFO] Major version changes allowed
[INFO] Updated ${spring-boot.version} from 2.1.3.RELEASE to 2.1.5.RELEASE
Running mvn use-latest-version finds 2.1.6.RELEASE.
My expectation is that update-properties also find 2.1.6.RELEASE.
So I've checked that scenario.
example (master)$ mvn org.codehaus.mojo:versions-maven-plugin:2.7:use-latest-versions
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.soebes.exmaple:example >---------------------
[INFO] Building Test 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.7:use-latest-versions (default-cli) @ example ---
[INFO] Major version changes allowed
[INFO] Updated org.springframework.boot:spring-boot-dependencies:pom:${spring-boot.version} to version 2.3.4.RELEASE
[INFO] Major version changes allowed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.825 s
[INFO] Finished at: 2020-10-06T16:57:54+02:00
[INFO] ------------------------------------------------------------------------
Now I tested the same with 2.8.1:
example (master)$ mvn org.codehaus.mojo:versions-maven-plugin:2.8.1:use-latest-versions
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.soebes.exmaple:example >---------------------
[INFO] Building Test 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.8.1:use-latest-versions (default-cli) @ example ---
[INFO] Major version changes allowed
[INFO] Major version changes allowed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.833 s
[INFO] Finished at: 2020-10-06T16:59:09+02:00
[INFO] ------------------------------------------------------------------------
and update-properties:
example (master)$ mvn org.codehaus.mojo:versions-maven-plugin:2.7:update-properties
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.soebes.exmaple:example >---------------------
[INFO] Building Test 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.7:update-properties (default-cli) @ example ---
[INFO] Major version changes allowed
[INFO] Updated ${spring-boot.version} from 2.1.3.RELEASE to 2.3.4.RELEASE
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.826 s
[INFO] Finished at: 2020-10-06T16:59:35+02:00
[INFO] ------------------------------------------------------------------------
And for 2.8.1
example (master)$ mvn org.codehaus.mojo:versions-maven-plugin:2.8.1:update-properties
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.soebes.exmaple:example >---------------------
[INFO] Building Test 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.8.1:update-properties (default-cli) @ example ---
[INFO] Major version changes allowed
[INFO] Updated ${spring-boot.version} from 2.1.3.RELEASE to 2.3.4.RELEASE
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.842 s
[INFO] Finished at: 2020-10-06T16:59:46+02:00
[INFO] ------------------------------------------------------------------------
That looks like a regression issue....
It seems, that the bug with 2.7.1 "use-latest-version removes/replaces the property" has been fixed with 2.8.0 via #340 / #396. Since then, use-latest-version doesn't touch the properties anymore, hence the pom is not modified.
The question now is: is this correct? update-properties vs. use-latest-versions
In case, you have a pom, where you use for some dependencies versions, but for other dependencies you use direct versions, then you'd need to call both goals to update all dependencies.
I can see the point, that when calling "use-latest-version", you expect that all your dependencies are updated to the latest version, regardless whether the version is specified directly or indirectly via property (in that case, the property should be updated, like with "update-properties").
Back to the original problem: the property spring-boot.version is used on two different artifacts: org.springframework.boot:spring-boot-dependencies (a dependency in dependencyManagement) and org.springframework.boot:spring-boot-maven-plugin(a plugin in pluginManagement). That maybe influences, which version is selected as the latest. However on search.maven.org versions 2.1.5.RELEASE/2.1.6.RELEASE of both artifacts are released on the same day (15-May-2019 / 19-Jun-2019). Maybe there is some caching ongoing? On the other hand, "update-properties" doesn't seem to care about plugins, so only "org.springframework.boot:spring-boot-dependencies" should have been checked and both goals should have been seeing the same latest version....
Hope that helps.
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days.