You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Paul Benedict (JIRA)" <ji...@codehaus.org> on 2014/07/02 15:44:16 UTC

[jira] (MNG-4584) Setting scope of transitive dependency can break version resolution

     [ https://jira.codehaus.org/browse/MNG-4584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated MNG-4584:
-------------------------------

    Fix Version/s:     (was: Issues to be reviewed for 3.x)

> Setting scope of transitive dependency can break version resolution
> -------------------------------------------------------------------
>
>                 Key: MNG-4584
>                 URL: https://jira.codehaus.org/browse/MNG-4584
>             Project: Maven
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 2.2.1
>         Environment: Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500)
> Java version: 1.5.0_19
> Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x" version: "10.4.11" arch: "ppc" Family: "unix"
>            Reporter: Craig S. Cottingham
>
> I have an artifact A which has a dependency with default scope on javax.mail:mail:1.4.1.
> I have an artifact B which has a dependency with default scope on A, and a dependency with runtime scope on log4j:log4j:1.2.15, which apparently has a dependency on javax.mail:mail:1.4. The dependency on A is defined in the POM before the dependency on log4j.
> When I run dependency:list or dependency:tree on B, I see that javax.mail:mail:1.4 is selected.
> mvn -X compile on B shows (amidst all the other output):
> ...
> [DEBUG]         javax.j2ee:j2ee:jar:1.3.1:compile (selected for compile)
> [DEBUG]         javax.mail:mail:jar:1.4.1:compile (selected for compile)
> [DEBUG]           javax.activation:activation:jar:1.1:compile (selected for compile)
> ...
> So far, so good.
> ...
> [DEBUG]               javax.mail:mail:jar:1.4:compile (removed - nearer found: 1.4.1)
> ...
> As expected. This shows up several times in the output, for various dependencies not mentioned above.
> ...
> [DEBUG]   javax.mail:mail:jar:1.4.1:provided
> ...
> This shows up several times as well.
> ...
> [DEBUG]   log4j:log4j:jar:1.2.15:runtime (selected for runtime)
> [DEBUG]     javax.mail:mail:jar:1.4:runtime (setting scope to: compile)
> [DEBUG]     javax.jms:jms:jar:1.1:runtime (selected for runtime)
> ...
> And here we hit the problem. It looks like the selected version for javax.mail:mail is being changed to 1.4 when the scope on that runtime dependency is changed to compile.
> The workaround for now is to add an explicit dependency on javax.mail:mail:1.4.1 to B.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)