Hello,
I've got problems with transitive dependencies in combination with
version ranges.
I use Maven Version 2.2.1
Example:
mvn dependency:tree ouput:
[INFO] X:X:jar:1.0.0
[INFO] +- Y:Y:jar:1.0.0:compile
[INFO] \- Z:Z:jar:1.0.0:compile
[INFO] \- A:A:jar:1.0.0:compile
in other words, dependency graph is as follows: X -> Y -> Z 1.0.0 -> A
If I call mvn dependency:resolve, I get the following output:
[INFO] The following files have been resolved:
[INFO] B:B:jar:1.0.0:compile
[INFO] Y:Y:jar:1.0.0:compile
[INFO] Z:Z:jar:1.0.0:compile
X -> Y -> Z 1.0.0 -> B
B is a wrong dependency. This is because of a version range, I've
defined in the pom of X:
<groupId>X</groupId>
<artifactId>X</artifactId>
<name>X</name>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>Y</groupId>
<artifactId>Y</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>Z</groupId>
<artifactId>Z</artifactId>
<version>[1.0.0, 1.5.0]</version> <-- error happens
here
</dependency>
</dependencies>
And the following lines represent the pom of Y:
<groupId>Y</groupId>
<artifactId>Y</artifactId>
<name>Y</name>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>Z</groupId>
<artifactId>Z</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
What did happen? Y "whishes" to use Z in version 1.0.0. X does not
matter if Z 1.0.0 or Z 1.5.0 is used.
In the resolved dependencies, maven selects the prefered version 1.0.0
of Z (because Y wants it).
BUT instead of pulling the suitable Dependency A of Z 1.0.0, maven is
pulling the Dependency B of Z 1.5.0.
This can lead to horrible runtime exceptions (i.e
ClassNotfoundExceptions)
If I replace the version range with a fix version (i.e.
<version>1.5.0</version> or <version>1.0.0</version), the correct
dependant of Z is pulled.
I guess this is a bug.
If so where and how can I create a Jira issue? If this is a feature, can
anybody explain, please.
Maybe somebody can help.
Is it possible to attach files to this mailing list? I can offer a zip
with my example projects, if needed.
Greetings
Mario Wirth
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]