You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2017/05/01 19:18:04 UTC

[jira] [Commented] (MNG-6224) Dependency version from test scope leaks into compile scope

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

Robert Scholte commented on MNG-6224:
-------------------------------------

This is more related to MNG-6058. The discussion is more about what has a higher priority: scope or distance? Or to put it differently: is it possible to have a different version of an artifact on the classpath compared to the test-classpath. 
It has always been the definition that for every groupId+artifactId there's only one scope and one version(nearest). That explains why 3.0.1 is chosen.

> Dependency version from test scope leaks into compile scope
> -----------------------------------------------------------
>
>                 Key: MNG-6224
>                 URL: https://issues.apache.org/jira/browse/MNG-6224
>             Project: Maven
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 3.3.9
>            Reporter: Andrei Tomashpolskiy
>         Attachments: mvn_package.txt
>
>
> Despite test scope being non-transitive [1] it's still used to resolve versions of compile dependencies. This might be causing issues in IDEs that rely on the Dependency plugin to assemble the application's classpath.
> E.g. for the following project configuration *javax.servlet-api* version is resolved to *3.0.1* (using nearest-first strategy to resolve conflicts):
> {noformat}
> project1
> |-- project2:compile
> |..|-- jetty-server:compile
> |....|-- javax.servlet-api:3.1.0:compile
> |-- jersey-test-framework-core:test
> |..|-- javax.servlet-api:3.0.1:compile
> {noformat}
> My understanding is that it should rather be resolved to 3.1.0, because version 3.0.1 stems from the test scope and should be ignored (AFAIK Maven Shade plugin works in that way).
> Please see a runnable code example in https://github.com/atomashpolskiy/maven-transitive-test-dependencies
> Thank you!
> [1] http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)