You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Arkadiusz Firus (Jira)" <ji...@apache.org> on 2020/10/22 08:07:00 UTC

[jira] [Created] (MNG-7003) Inconsistent dependency tree

Arkadiusz Firus created MNG-7003:
------------------------------------

             Summary: Inconsistent dependency tree
                 Key: MNG-7003
                 URL: https://issues.apache.org/jira/browse/MNG-7003
             Project: Maven
          Issue Type: Bug
          Components: Dependencies
    Affects Versions: 3.6.3
            Reporter: Arkadiusz Firus
         Attachments: maven_dependency_problem.tar.gz

I have found maven building different dependency tree during module built process and when a module is build as a dependency.

The problematic case:

pom ---> dependencyManagement (org.slf4j:slf4j-api:1.7.30)

  |-- pom --> dependency (org.apache.logging.log4j:log4j-slf4j18-impl:2.13.3) --> dependency (org.slf4j:slf4j-api:1.8.0-beta4)

 

When the project is built the dependency tree is OK. The version of transient dependency to slf4j-api is overridden by the dependency management mechanism.

{{[INFO] arcomp.maven_example:module:jar:1}}
 {{[INFO] - org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.13.3:compile}}
 {{[INFO] +- org.slf4j:slf4j-api:jar:*1.7.30*:compile}}
 {{[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile}}
 {{[INFO] - org.apache.logging.log4j:log4j-core:jar:2.13.3:runtime}}
  

On the other hand when the module is being used as a dependency the version of transient dependency is not overridden.

{{[INFO] arcomp.maven_example:usage:jar:1}}
 {{[INFO] - arcomp.maven_example:module:jar:1:compile}}
 {{[INFO] - org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.13.3:compile}}
 {{[INFO] +- org.slf4j:slf4j-api:jar:*1.8.0-beta4*:compile}}
 {{[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile}}
 {{[INFO] - org.apache.logging.log4j:log4j-core:jar:2.13.3:runtime}}
  

Such behaviour may lead to a problem when jar is used with different dependency than it was compiled and tested with.

I have attached three maven projects packed into archive. Two are in parent-child relationship where the dependency management mechanism is used described above. The third is a usage example.

I am new here, so please verify if I set the component (and other fields) correctly.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)