maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marrache (JIRA)" <>
Subject [jira] (MNG-5229) Improvement of nearest-wins strategy
Date Fri, 20 Jan 2012 13:23:02 GMT


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:
>             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
> 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
> 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.
> production, I mean not unit tests.)
> Unless I'm missing something, I think that the good behavior would be to choose the compile
> I open this issue after asking in the mailing list at this link
> Thanks

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message