[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=17748655#comment-17748655 ] Tamas Cservenak commented on MNG-6357: -- The PR with [~suztomo] reproducer: {noformat} [cstamas@urnebes main (master %)]$ mvn -V -Daether.system.resolveDependencies.visitor=preOrder -q exec:exec -Dexec.executable=echo -Dexec.args="%classpath" Apache Maven 3.9.5-SNAPSHOT (bf3261cc66fd653ed3457153b2bfbe9bbc7d5d7b) Maven home: /home/cstamas/.sdkman/candidates/maven/3.9.5-SNAPSHOT Java version: 17.0.8, vendor: Eclipse Adoptium, runtime: /home/cstamas/.sdkman/candidates/java/17.0.8-tem Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "6.4.6-200.fc38.x86_64", arch: "amd64", family: "unix" /home/cstamas/tmp/MNG-6357/triangle-linkage-error/main/target/classes:/home/cstamas/.m2/repository-oss/suztomo/artifact1/0.0.1-SNAPSHOT/artifact1-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact4/0.0.1-SNAPSHOT/artifact4-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact2/0.0.1-SNAPSHOT/artifact2-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact5/0.0.1-SNAPSHOT/artifact5-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact3/0.0.1-SNAPSHOT/artifact3-0.0.1-SNAPSHOT.jar [cstamas@urnebes main (master %)]$ mvn -V -Daether.system.resolveDependencies.visitor=levelOrder -q exec:exec -Dexec.executable=echo -Dexec.args="%classpath" Apache Maven 3.9.5-SNAPSHOT (bf3261cc66fd653ed3457153b2bfbe9bbc7d5d7b) Maven home: /home/cstamas/.sdkman/candidates/maven/3.9.5-SNAPSHOT Java version: 17.0.8, vendor: Eclipse Adoptium, runtime: /home/cstamas/.sdkman/candidates/java/17.0.8-tem Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "6.4.6-200.fc38.x86_64", arch: "amd64", family: "unix" /home/cstamas/tmp/MNG-6357/triangle-linkage-error/main/target/classes:/home/cstamas/.m2/repository-oss/suztomo/artifact1/0.0.1-SNAPSHOT/artifact1-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact2/0.0.1-SNAPSHOT/artifact2-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact3/0.0.1-SNAPSHOT/artifact3-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact4/0.0.1-SNAPSHOT/artifact4-0.0.1-SNAPSHOT.jar:/home/cstamas/.m2/repository-oss/suztomo/artifact5/0.0.1-SNAPSHOT/artifact5-0.0.1-SNAPSHOT.jar [cstamas@urnebes main (master %)]$ {noformat} > 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 > Fix For: 4.0.x-candidate > > 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.20.10#820010)
[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=17748214#comment-17748214 ] Tamas Cservenak commented on MNG-6357: -- Related experiment https://github.com/apache/maven/pull/1212 > 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 > Fix For: 4.0.x-candidate > > 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.20.10#820010)
[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=17747805#comment-17747805 ] Vladimir Sitnikov commented on MNG-6357: {quote}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.{quote} I am afraid "nearest wins" is not reliable, and it is not predictable for the end users. See examples in MNG-7852. I suggest Maven should consider all the dependencies not just the nearest. > 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 > Fix For: 4.0.x-candidate > > 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.20.10#820010)
[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=17690804#comment-17690804 ] ASF GitHub Bot commented on MNG-6357: - cowwoc commented on PR #281: URL: https://github.com/apache/maven/pull/281#issuecomment-1435735037 Per https://maven.apache.org/download.cgi Maven 4.x requires JDK 8. What is needed to move this PR forward? > 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 > Fix For: 4.0.x-candidate > > 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.20.10#820010)
[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=17466309#comment-17466309 ] Jeff Hodges commented on MNG-6357: -- I've dropped a couple comments on the two PRs. Both PRs have only small conflicts and, if the original author or a contributor doesn't have time to update them, I'm happy to make new PRs with the branches I've got. > 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 > Fix For: 4.0.x-candidate > > 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.20.1#820001)
[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=17413761#comment-17413761 ] Michael Osipov commented on MNG-6357: - One needs to update the PR first. > 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 > Fix For: 4.0.x-candidate > > 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)
[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=17413377#comment-17413377 ] Jeff Maxwell commented on MNG-6357: --- Can we please get this issue added to 4.0? > 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)
[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=17082550#comment-17082550 ] Tomo Suzuki commented on MNG-6357: -- For building a class path for different artifactIDs, it does not. > 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)
[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=17082482#comment-17082482 ] Elliotte Rusty Harold commented on MNG-6357: Wait, I'm confused. I thought this is how it did work already. > 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)
[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)
[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=16824520#comment-16824520 ] Tomo Suzuki commented on MNG-6357: -- I encountered this issue today. I had an assumption that Maven exec plugin builds a class path in "nearest first" manner, but it actually treats it in "depth first" manner. Code to reproduce: [https://github.com/suztomo/triangle-linkage-error] . Given this tree of transitive dependencies Artifact 1 - 5. {{ suztomo:main:jar:0.0.1-SNAPSHOT}} {{ +- suztomo:artifact1}} {{ | - suztomo:artifact4}} {{ +- suztomo:artifact2}} {{ | - suztomo:artifact5}} {{ \- suztomo:artifact3}} I expected Maven exec plugin to build a class path of "artifact1, artifact2, artifact3, artifact4, artifact5". However it builds a class path of "artifact1, artifact*4*, artifact2, artifact*5*, artifact3". In Github discussion [https://github.com/mojohaus/exec-maven-plugin/issues/91], rfscholte wrote _>Hervé confirmed that the "nearest wins" is only about version selection and not about dependency order. This order is simply done by tree-walking. However, we agreed that it would make sense to compile based on the direct dependencies first, followed by first level, second level, etc._ Thank you. I also think that's intuitive behavior, in line with Maven's dependency mediation algorithm. > 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 > > 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 (v7.6.3#76005)