Maven will take the
shortest
path to a dependency and use that version.
In case there are multiple paths of the same length, the first one wins.
This means that in the example above, the version of
guava
will be
20.0
because the direct dependency is
closer
than the
guice
dependency.
The main drawback of this method is that it is ordering dependent.
Keeping order in a very large graph can be a challenge.
For example, what if the new version of a dependency ends up having its own dependency declarations in a different order than the previous version?
With Maven, this could have unwanted impact on resolved versions.