Let's assume we have a Project A.
In this case, how would Maven resolve the conflict?
I found this explanation and it was really helpful to me.
Nearest definition means that the version used will be the closest one to your project in the tree of dependencies,
eg. if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0
It'd build with Project B v 1.0
You can use http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html to see, that it omitted B 2.0 cause 1.0 is nearer.
from page above:
by default Maven resolves version conflicts with a nearest-wins strategy.
Output'd be something like that:
[INFO] [dependency:tree]
[INFO] Project A
[INFO] +- Project-B:jar:1.0:compile
[INFO] \- Project-C:jar:2.0:compile
[INFO] \- (Project-B:jar:2.0:compile - ommited for conflicts with 1.0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With