When there are two different dependency versions for dependency are at the same depth in the dependency tree, how does maven select the version to use?
Asked
Active
Viewed 121 times
0
-
POM order. This is in the docs: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html *Note that if 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.* See the linked question. – Tunaki Apr 21 '16 at 15:35
-
1Possible duplicate of [Maven resolving versions of dependencies](http://stackoverflow.com/questions/30913724/maven-resolving-versions-of-dependencies) – Tunaki Apr 21 '16 at 15:36
-
I don't understand what is meant by the order in the declaration, say A depends on B and C, and B depends on version 1.1.1 of D and C depends on 1.1.2 of D, what will A pick? – Chamila Wijayarathna Apr 21 '16 at 15:43
-
1Your project depends on A1 and A2. A1 depends on B. A2 depends on B' (different version than B). If A1 is declared before in your POM then B will be kept. – Tunaki Apr 21 '16 at 15:45