You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (Jira)" <ji...@apache.org> on 2019/12/18 10:19:00 UTC

[jira] [Commented] (MNG-6357) Dependency order should be nearest first

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

elharo commented on MNG-6357:
-----------------------------

There might be other edge cases where this matters. For instance, imagine there's a corrupt jar file somewhere in the middle of the classpath. The order could determine whether the class loader hits it and throws an exception before it resolves the class it's looking for in a different jar file.

> Dependency order should be nearest first 
> -----------------------------------------
>
>                 Key: MNG-6357
>                 URL: https://issues.apache.org/jira/browse/MNG-6357
>             Project: Maven
>          Issue Type: Improvement
>            Reporter: Robert Scholte
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> In case of version conflicts, the nearest wins. However, the dependency order is simply based on tree walking. In the rare that a transitive dependency of the first direct dependency contains the same class as a latter direct dependency, the code is compiled against the first one, which is odd.
> It would make more sense if direct dependencies are the first ones on the classpath, followed by the first level transitive dependencies, etc. This will make the explanation equal to version conflict resolution: nearest wins.
> I don't expect real issues due to this change, otherwise we would have had this issue much earlier. This should become the new default order, however there should be a system property to get the original order, just in case somebody needs it.
>  
> Current workaround: make the critical dependency the first direct dependency.



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