[jira] [Comment Edited] (MNG-5980) DependencyGraphBuilder gives different results depending on the order of dependencies in the pom

2019-12-16 Thread elharo (Jira)


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

elharo edited comment on MNG-5980 at 12/16/19 5:34 PM:
---

Consider the case where class com.example.Foo is found in A.jar and B.jar, both 
in the classpath, which can happen in Java 8 and earlier. Is it arbitrary which 
version of the class is loaded?

I don't think{{ java -cp '*.jar' }}will even run since it doesn't separate the 
entries with colons. 

The issue with Tomcat is, I suspect, that Tomcat doesn't guarantee the order in 
which it places jars in the WEB-INF directory into the classpath, not that the 
class loading is indeterminate once the classpath is formed. 


was (Author: elh...@metalab.unc.edu):
Consider the case where class com.example.Foo is found in A.jar and B.jar, both 
in the classpath, which can happen in Java 8 and earlier. Is it arbitrary which 
version of the class is loaded?

I don't think{{ java -cp '*.jar' }}will even run since it doesn't separate the 
entries with colons. 

> DependencyGraphBuilder gives different results depending on the order of 
> dependencies in the pom
> 
>
> Key: MNG-5980
> URL: https://issues.apache.org/jira/browse/MNG-5980
> Project: Maven
>  Issue Type: Bug
>  Components: Dependencies, Plugin API
> Environment: Kubuntu 14.10
> Java 8
> Maven 3.0.5/3.3.9
> maven-dependency-tree 2.1/3.0
>Reporter: Gerrit Daniels
>Priority: Major
> Attachments: dependency-graph-builder-bug.zip
>
>
> I'm getting different results when using DependencyGraphBuilder in a plugin 
> depending on the order in which the dependencies are defined in the pom of 
> the project the plugin is running on. I have created some test projects to 
> reproduce the bug.
> - actual-dependency: This is the dependency that moves when changing the 
> order in the pom.
> - test-dependency: Depends on the actual-dependency with compile scope.
> - compile-dependency: Also depends on the actual-dependency with compile 
> scope.
> - main-project: Depends on the test-dependency with test scope and on the 
> compile-dependency with compile scope. Has the plugin configured.
> - plugin: Builds the dependency graph.
> When running maven with the -X switch on the main project with the 
> test-dependency declared first in the pom I get the following dependency 
> graph:
> {code}
> [DEBUG] com.qmino:main-project:jar:1.0-SNAPSHOT
> [DEBUG]com.qmino:test-dependency:jar:1.0-SNAPSHOT:test
> [DEBUG]   com.qmino:actual-dependency:jar:1.0-SNAPSHOT:compile
> [DEBUG]com.qmino:compile-dependency:jar:1.0-SNAPSHOT:compile
> {code}
> When I change the order of the dependencies I get:
> {code}
> [DEBUG] com.qmino:main-project:jar:1.0-SNAPSHOT
> [DEBUG]com.qmino:compile-dependency:jar:1.0-SNAPSHOT:compile
> [DEBUG]   com.qmino:actual-dependency:jar:1.0-SNAPSHOT:compile
> [DEBUG]com.qmino:test-dependency:jar:1.0-SNAPSHOT:test
> {code}
> It seems to me that the order of the dependencies shouldn't change the 
> results. In both cases I would expect the second output, since the compile 
> scope should overrule the test scope.



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


[jira] [Comment Edited] (MNG-5980) DependencyGraphBuilder gives different results depending on the order of dependencies in the pom

2019-12-16 Thread elharo (Jira)


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

elharo edited comment on MNG-5980 at 12/16/19 5:31 PM:
---

Consider the case where class com.example.Foo is found in A.jar and B.jar, both 
in the classpath, which can happen in Java 8 and earlier. Is it arbitrary which 
version of the class is loaded?

I don't think{{ java -cp '*.jar' }}will even run since it doesn't separate the 
entries with colons. 


was (Author: elh...@metalab.unc.edu):
Consider the case where class com.example.Foo is found in A.jar and B.jar, both 
in the claspath, which can happen in Java 8 and earlier. Is it arbitrary which 
version of the class is loaded?

I don't think `java -cp '*.jar'` will even run since it doesn't separate the 
entries with colons. 

> DependencyGraphBuilder gives different results depending on the order of 
> dependencies in the pom
> 
>
> Key: MNG-5980
> URL: https://issues.apache.org/jira/browse/MNG-5980
> Project: Maven
>  Issue Type: Bug
>  Components: Dependencies, Plugin API
> Environment: Kubuntu 14.10
> Java 8
> Maven 3.0.5/3.3.9
> maven-dependency-tree 2.1/3.0
>Reporter: Gerrit Daniels
>Priority: Major
> Attachments: dependency-graph-builder-bug.zip
>
>
> I'm getting different results when using DependencyGraphBuilder in a plugin 
> depending on the order in which the dependencies are defined in the pom of 
> the project the plugin is running on. I have created some test projects to 
> reproduce the bug.
> - actual-dependency: This is the dependency that moves when changing the 
> order in the pom.
> - test-dependency: Depends on the actual-dependency with compile scope.
> - compile-dependency: Also depends on the actual-dependency with compile 
> scope.
> - main-project: Depends on the test-dependency with test scope and on the 
> compile-dependency with compile scope. Has the plugin configured.
> - plugin: Builds the dependency graph.
> When running maven with the -X switch on the main project with the 
> test-dependency declared first in the pom I get the following dependency 
> graph:
> {code}
> [DEBUG] com.qmino:main-project:jar:1.0-SNAPSHOT
> [DEBUG]com.qmino:test-dependency:jar:1.0-SNAPSHOT:test
> [DEBUG]   com.qmino:actual-dependency:jar:1.0-SNAPSHOT:compile
> [DEBUG]com.qmino:compile-dependency:jar:1.0-SNAPSHOT:compile
> {code}
> When I change the order of the dependencies I get:
> {code}
> [DEBUG] com.qmino:main-project:jar:1.0-SNAPSHOT
> [DEBUG]com.qmino:compile-dependency:jar:1.0-SNAPSHOT:compile
> [DEBUG]   com.qmino:actual-dependency:jar:1.0-SNAPSHOT:compile
> [DEBUG]com.qmino:test-dependency:jar:1.0-SNAPSHOT:test
> {code}
> It seems to me that the order of the dependencies shouldn't change the 
> results. In both cases I would expect the second output, since the compile 
> scope should overrule the test scope.



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