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

Maven extract fails to resolve placeholders from parent module #31004

Open
rarkins opened this issue Aug 25, 2024 Discussed in #30778 · 0 comments
Open

Maven extract fails to resolve placeholders from parent module #31004

rarkins opened this issue Aug 25, 2024 Discussed in #30778 · 0 comments
Labels
manager:maven Maven (Java) package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@rarkins
Copy link
Collaborator

rarkins commented Aug 25, 2024

Discussed in #30778

Originally posted by acote-coveo August 14, 2024

What would you like help with?

I think I found a bug

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

Github

Please tell us more about your question or problem

Hi,

Renovate is skipping our maven dependencies because it is not able to resolve the placeholder within the dependency name.

I've made a reproduction example here: https://github.com/acote-coveo/renovate-bug/blob/main/README.md

Excerpt from the repro:

Project setup

  • Parent module (parent)
    • Child module (child)

The parent module define some properties (e.g: which scala version to use):

    <properties>
        <scala-parent.scala-lib.version>2.12</scala-parent.scala-lib.version>
    </properties>

The child module leverage the parent properties to add some dependencies (e.g: json4s):

<parent>
        <groupId>com.coveo</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
</parent>

<properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

<dependencies>
    <dependency>
        <groupId>org.json4s</groupId>
        <artifactId>json4s-core_${scala-parent.scala-lib.version}</artifactId>
        <version>4.0.7</version>
    </dependency>
</dependencies>

Upon running renovate, dependencies using parent properties are getting skip because renovate is not able to resolve the parent properties.

How to reproduce:

pushd parent
mvn install
popd

pushd child
mvn install

# Run renovate in debug mode
LOG_LEVEL=DEBUG npx renovate --platform=local


popd

Upon running the npx renovate command, you should notice the following error:

{
         "maven": [
           {
             "datasource": "maven",
             "packageFile": "pom.xml",
             "deps": [
               {
                 "datasource": "maven",
                 "depName": "com.coveo:parent",
                 "currentValue": "1.0-SNAPSHOT",
                 "fileReplacePosition": 514,
                 "registryUrls": ["https://repo.maven.apache.org/maven2"],
                 "depType": "parent",
                 "updates": [],
                 "packageName": "com.coveo:parent",
                 "versioning": "maven",
                 "warnings": [
                   // This warning is due to the fact that I haven't deployed my package.
                   // Internally our parent module gets resolved properly but we still have the skipReason name-placeholder bellow.
                   {
                     "topic": "com.coveo:parent",
                     "message": "Failed to look up maven package com.coveo:parent"
                   }
                 ]
               },
               {
                 "datasource": "maven",
                 "depName": "org.json4s:json4s-core_${scala-parent.scala-lib.version}",
                 "currentValue": "4.0.7",
                 "fileReplacePosition": 965,
                 "registryUrls": ["https://repo.maven.apache.org/maven2"],
                 "depType": "compile",
                 "skipReason": "name-placeholder",
                 "updates": [],
                 "packageName": "org.json4s:json4s-core_${scala-parent.scala-lib.version}"
               }
             ],
             "packageFileVersion": "1.0-SNAPSHOT"
           }
         ]
       }

Logs (if relevant)

Logs
{
         "maven": [
           {
             "datasource": "maven",
             "packageFile": "pom.xml",
             "deps": [
               {
                 "datasource": "maven",
                 "depName": "com.coveo:parent",
                 "currentValue": "1.0-SNAPSHOT",
                 "fileReplacePosition": 514,
                 "registryUrls": ["https://repo.maven.apache.org/maven2"],
                 "depType": "parent",
                 "updates": [],
                 "packageName": "com.coveo:parent",
                 "versioning": "maven",
                 "warnings": [
                   // This warning is due to the fact that I haven't deployed my package.
                   // Internally our parent module gets resolved properly but we still have the skipReason name-placeholder bellow.
                   {
                     "topic": "com.coveo:parent",
                     "message": "Failed to look up maven package com.coveo:parent"
                   }
                 ]
               },
               {
                 "datasource": "maven",
                 "depName": "org.json4s:json4s-core_${scala-parent.scala-lib.version}",
                 "currentValue": "4.0.7",
                 "fileReplacePosition": 965,
                 "registryUrls": ["https://repo.maven.apache.org/maven2"],
                 "depType": "compile",
                 "skipReason": "name-placeholder",
                 "updates": [],
                 "packageName": "org.json4s:json4s-core_${scala-parent.scala-lib.version}"
               }
             ],
             "packageFileVersion": "1.0-SNAPSHOT"
           }
         ]
       }

Reproduction forked to https://github.com/renovate-reproductions/30778

@rarkins rarkins added type:bug Bug fix of existing functionality priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others manager:maven Maven (Java) package manager labels Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:maven Maven (Java) package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant