[
https://jira.codehaus.org/browse/MNG-5229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=288923#comment-288923
]
Marrache commented on MNG-5229:
-------------------------------
To add to the description, I understand that Maven uses the nearest-wins
strategy for conflicts with versions (choosing the nearest in the case one of
the conflicted artifact is a direct dependency of the root project seems to be
a good solution). But why to pretend the same with scopes? In the scenario I
exposed, there are no conflicts with versions, only with scope. And in this
case, the nearest-wins strategy is not appropriated (it is even wrong, I think).
> Improvement of nearest-wins strategy
> ------------------------------------
>
> Key: MNG-5229
> URL: https://jira.codehaus.org/browse/MNG-5229
> Project: Maven 2 & 3
> Issue Type: Improvement
> Components: Dependencies
> Affects Versions: 3.0.3
> Reporter: Marrache
>
> I have a project A that uses library L v1.0.0 with test scope.
> Project A also depends on project B (with scope compile), with B transitively
> depending
> on the library L v1.0.0 (with scope compile). So, according to the
> documentation (Introduction
> to dependency mechanism), project A depends on project B with scope "compile"
> and the transitive
> dependency on L has a "compile" scope, the final scope of L should be
> "compile".
> Here, Maven sees one dependency on L with scope "compile" (after applying the
> dependency
> algorithm), and one dependency on L with scope "test". And because the second
> is nearest to the root (project A), it chooses it, so with a 'test' scope.
> Why the final scope of the library
> L for project A is not 'compile'?
> My project A only uses L for unit tests so I define the dependency
> with 'test' scope. But, at the end, I want L to be on my classpath since
> project A depends
> on project B for production, and B needs (transitively) library L also for
> production. (By
> production, I mean not unit tests.)
> Unless I'm missing something, I think that the good behavior would be to
> choose the compile scope.
> I open this issue after asking in the mailing list at this link
> http://mail-archives.apache.org/mod_mbox/maven-users/201201.mbox/%3C6EA53FAD386F9D46B97D49BFE148D5140F14B75E6B%40ISR-JLM-MAIL1.xconnect.co.il%3E
> Thanks
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira