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-dependency-updates does not resolve versions specified via properties if processDependencyManagementTransitive=false #614

Closed
andreyakostov opened this issue Jul 6, 2022 · 4 comments · Fixed by #797
Labels
Milestone

Comments

@andreyakostov
Copy link

The issue can be reproduced with the following POM:

<?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>

  <groupId>com.test</groupId>
  <artifactId>reproduce-version-via-property-issue</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <properties>
    <com.fasterxml.jackson.databind.version>2.13.2.2</com.fasterxml.jackson.databind.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${com.fasterxml.jackson.databind.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

</project>

Executing mvn org.codehaus.mojo:versions-maven-plugin:2.11.0:display-dependency-updates -DprocessDependencyManagementTransitive=true yields the following result:

[INFO] --- versions-maven-plugin:2.11.0:display-dependency-updates (default-cli) @ reproduce-version-via-property-issue ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO]   com.fasterxml.jackson.core:jackson-databind ....... 2.13.2.2 -> 2.13.3

While mvn org.codehaus.mojo:versions-maven-plugin:2.11.0:display-dependency-updates -DprocessDependencyManagementTransitive=false produces:

[INFO] --- versions-maven-plugin:2.11.0:display-dependency-updates (default-cli) @ reproduce-version-via-property-issue ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO]   com.fasterxml.jackson.core:jackson-databind ...
[INFO]                      ${com.fasterxml.jackson.databind.version} -> 2.13.3
@andreyakostov andreyakostov changed the title display-dependency-updates does not resolve versions specified via properties if processDependencyManagementTransitive=false display-dependency-updates does not resolve versions specified via properties if processDependencyManagementTransitive=false Jul 6, 2022
@andreyakostov andreyakostov changed the title display-dependency-updates does not resolve versions specified via properties if processDependencyManagementTransitive=false display-dependency-updates does not resolve versions specified via properties if processDependencyManagementTransitive=false Jul 6, 2022
@bmarwell
Copy link
Contributor

Can you contribute your example as an IT? That would be very helpful!

@merikan
Copy link

merikan commented Jul 28, 2022

I can see the same behavior using processDependencyManagementTransitive=false but in a multi module project the property is never resolved in the parent module regardless of whether there is an update or not.

With update available

[INFO] Reactor Build Order:
[INFO]
[INFO] reproduce-version-via-property-issue                               [pom]
[INFO] child                                                              [pom]
[INFO]
[INFO] -----------< com.test:reproduce-version-via-property-issue >------------
[INFO] Building reproduce-version-via-property-issue 1.11.0-SNAPSHOT      [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.11.0:display-dependency-updates (default-cli) @ reproduce-version-via-property-issue ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO]   com.fasterxml.jackson.core:jackson-databind ...
[INFO]                      ${com.fasterxml.jackson.databind.version} -> 2.13.3
[INFO]
[INFO]
[INFO] ---------------------------< com.test:child >---------------------------
[INFO] Building child 1.11.0-SNAPSHOT                                     [2/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.11.0:display-dependency-updates (default-cli) @ child ---
[INFO] The following dependencies in Dependencies have newer versions:
[INFO]   com.fasterxml.jackson.core:jackson-databind ....... 2.13.2.2 -> 2.13.3

No update available, using 2.13.3

[INFO] Reactor Build Order:
[INFO]
[INFO] reproduce-version-via-property-issue                               [pom]
[INFO] child                                                              [pom]
[INFO]
[INFO] -----------< com.test:reproduce-version-via-property-issue >------------
[INFO] Building reproduce-version-via-property-issue 1.11.0-SNAPSHOT      [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.11.0:display-dependency-updates (default-cli) @ reproduce-version-via-property-issue ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO]   com.fasterxml.jackson.core:jackson-databind ...
[INFO]                      ${com.fasterxml.jackson.databind.version} -> 2.13.3
[INFO]
[INFO]
[INFO] ---------------------------< com.test:child >---------------------------
[INFO] Building child 1.11.0-SNAPSHOT                                     [2/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.11.0:display-dependency-updates (default-cli) @ child ---
[INFO] No dependencies in Dependencies have newer versions.

parent pom

<?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>

  <groupId>com.test</groupId>
  <artifactId>reproduce-version-via-property-issue</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <properties>
    <com.fasterxml.jackson.databind.version>2.13.2.2</com.fasterxml.jackson.databind.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${com.fasterxml.jackson.databind.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <modules>
    <module>child</module>
  </modules>

</project>

child pom

<?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>com.test</groupId>
    <artifactId>reproduce-version-via-property-issue</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>
  <artifactId>child</artifactId>
  <packaging>pom</packaging>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
  </dependencies>

</project>

@TorstenKruse
Copy link
Contributor

The same for me with the goal "versions:dependency-updates-report". As soon as I set processDependencyManagementTransitive=false the HTML report contains only placeholders in the "current version" column when the version is defined in a pom property.

@andrzejj0
Copy link
Contributor

andrzejj0 commented Oct 26, 2022

Ah yes, project.getOriginalModel() (which is what is used processDependencyManagementTransitive=false) if is not interpolated. Hence, property values are not resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants