[Commented] (MDEP-670) <dependencyManagement> override indirect dependency version when run dependency:tree

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Commented] (MDEP-670) <dependencyManagement> override indirect dependency version when run dependency:tree

Herve Boutemy (Jira)

    [ https://issues.apache.org/jira/browse/MDEP-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17067829#comment-17067829 ]

Karl Heinz Marbaise commented on MDEP-670:
------------------------------------------

The example defines the in {{module1}} the dependency {{org.slf4j:slf4j-api:1.7.0}}. The {{module2}} defines via {{dependencyManagement}} the dependency {{org.slf4j:slf4j-api:1.6.0}} and has a dependency to {{module1}} and the output of {{maven-dependency-plugin:tree}} looks like this:
{code}
[INFO] --------------------< org.apache.maven:demo-parent >--------------------
[INFO] Building demo-parent 1.0                                           [1/3]
..
[INFO] ----------------------< org.apache.maven:module1 >----------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ module1 ---
[INFO] org.apache.maven:module1:jar:1.0
[INFO] \- org.slf4j:slf4j-api:jar:1.7.0:compile
[INFO]
[INFO] ----------------------< org.apache.maven:module2 >----------------------
[INFO] Building module2 1.0                                               [3/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ module2 ---
[INFO] org.apache.maven:module2:jar:1.0
[INFO] \- org.apache.maven:module1:jar:1.0:compile
[INFO]    \- org.slf4j:slf4j-api:jar:1.6.0:compile
[INFO] ------------------------------------------------------------------------
{code}
So what you see is in {{module1}} the {{org.slf4j:slf4j-api:1.7.0}} dependency. In {{module2}} you see the {{org.slf4j:slf4j-api:1.6.0}} which is overruled by the given {{dependencyManagement}} in {{module2}}.
It's unusual to put a {{dependencyManagement}} into a child module but of course you can do it. But unfortunately I don't an issue here. It exactly does what it should be.

> <dependencyManagement> override indirect dependency version when run dependency:tree
> ------------------------------------------------------------------------------------
>
>                 Key: MDEP-670
>                 URL: https://issues.apache.org/jira/browse/MDEP-670
>             Project: Maven Dependency Plugin
>          Issue Type: Bug
>          Components: tree
>    Affects Versions: 3.1.1
>            Reporter: yx91490
>            Priority: Major
>         Attachments: mdep-670.tgz
>
>
> 1. Define a dependency (for example {{org.slf4j:slf4j-api:1.6.0}}) in <{{dependencyManagement>}}
> 2. Depend a middle dependency with indirect dependency {{org.slf4j:slf4j-api:1.7.0}}
> 3. Run {{dependency:tree}} will show the middle dependency depend with {{1.6.0}} rather than {{1.7.0}}
>  



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