Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display-parent-updates does not show updates correctly #896

Closed
hetzijzo opened this issue Jan 2, 2023 · 5 comments · Fixed by #897
Closed

display-parent-updates does not show updates correctly #896

hetzijzo opened this issue Jan 2, 2023 · 5 comments · Fixed by #897
Labels
Milestone

Comments

@hetzijzo
Copy link

hetzijzo commented Jan 2, 2023

From version 2.14.0 the display-parent-updates does not show newer parent versions anymore.

Given I have a project which has a newer parent version in our maven repository.
When I run mvn org.codehaus.mojo:versions-maven-plugin:2.14.0:display-parent-updates
Then I expect to see The parent project has a newer version

But instead I see The parent project is the latest version

Running with a plugin version of 2.13.0 it gives the correct result.

@andrzejj0
Copy link
Contributor

andrzejj0 commented Jan 2, 2023

Please check with 2.14.2 as this is the newest release of the plugin.

If the problem occurs there as well, please provide an example project (pom.xml) which reproduces the issue.

@hetzijzo
Copy link
Author

hetzijzo commented Jan 2, 2023

Creating a project with start.spring.io and downgrade the parent version from 2.7.7 to 2.7.6

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.6</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>
  <groupId>com.example</groupId>
  <artifactId>demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>demo</name>
  <description>Demo project for Spring Boot</description>
  <properties>
    <java.version>11</java.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

</project>

Test Result 2.14.2
Now run the command mvn org.codehaus.mojo:versions-maven-plugin:2.14.2:display-parent-updates.
This will give us the following result:

$ mvn org.codehaus.mojo:versions-maven-plugin:2.14.2:display-parent-updates
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.14.2:display-parent-updates (default-cli) @ demo ---
[INFO] The parent project is the latest version:
[INFO]   org.springframework.boot:spring-boot-starter-parent ......... 2.7.6
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.674 s
[INFO] Finished at: 2023-01-02T16:09:15+01:00
[INFO] ------------------------------------------------------------------------

Test Result 2.13.0
Using the same starting point with the above pom.xml. Now run the command mvn org.codehaus.mojo:versions-maven-plugin:2.13.0:display-parent-updates.
This will give us the following result:

$ mvn org.codehaus.mojo:versions-maven-plugin:2.13.0:display-parent-updates
[INFO] Scanning for projects...
[versions-demo.zip](https://github.com/mojohaus/versions/files/10332345/versions-demo.zip)

[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.13.0:display-parent-updates (default-cli) @ demo ---
[INFO] The parent project has a newer version:
[INFO]   org.springframework.boot:spring-boot-starter-parent  2.7.6 -> 3.0.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.030 s
[INFO] Finished at: 2023-01-02T16:12:34+01:00
[INFO] ------------------------------------------------------------------------

@andrzejj0
Copy link
Contributor

Thanks, confirmed.

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jan 2, 2023
…r the retrieval of available versions if it's specified.

Previously I (mistakenly) used the "recommended version" as version range, which caused artifact version retrieval to only report the given version.
@andrzejj0
Copy link
Contributor

Polishing...

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jan 2, 2023
…wSnapshots

- Version range should not be specified in the retrieval at all; removed.
- If provided, the actual version range restriction should be used, and not the result of the toString() method
- Also, allowSnapshots was ignored for the mojo; corrected
@andrzejj0
Copy link
Contributor

andrzejj0 commented Jan 2, 2023

Thanks for the report.

Running a bespoke test with the org.springframework.boot:spring-boot-starter-parent:2.7.6 as parent yields with the patch:

The parent project has a newer version:
  org.springframework.boot:spring-boot-starter-parent  2.7.6 -> 3.0.1

@slawekjaranowski slawekjaranowski added this to the 2.15.0 milestone Jan 8, 2023
slawekjaranowski pushed a commit that referenced this issue Jan 8, 2023
- Version range should not be specified in the retrieval at all; removed.
- If provided, the actual version range restriction should be used, and not the result of the toString() method
- Also, allowSnapshots was ignored for the mojo; corrected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants