- Let's assume my application needs
foo.jar
andbar.jar
foo.jar
needs version 1.0 ofc.jar
bar.jar
needs version 2.0 ofc.jar
How does Maven resolve this conflict? Which version of c.jar
will be used?
It depends on the order of declaration in your effective POM. If foo.jar
shows up first you will get version 1.0 of c.jar
. If on the other hand bar.jar
is declared first it will be version 2.0 of c.jar
.
Relevant documentation:
...two dependency versions are at the same depth in the dependency tree, until Maven 2.0.8 it was not defined which one would win, but since Maven 2.0.9 it's the order in the declaration that counts: the first declaration wins
来源:https://stackoverflow.com/questions/8023646/maven-transitive-dependencies-with-different-versions