0
votes

Suppose I define the version of some artifact in my dependencyManagement section.

Is it correct that this version definition overwrites all version definitions in transitive dependencies?

Or does it only solve version conflicts?

So if I put foo in version 2.0.0 in my dependencyManagement and some transitive dependency has foo in version 1.0.0, do I always get 2.0.0?

1

1 Answers

0
votes

That is how it would work with Maven 2. And generally speaking that's the basic rule: whatever your project specifies takes precedence over whatever your dependencies specify.

However, according to Maven 3.x Compatibility Notes, this process was changed in Maven 3. Now it uses Aether and is supposed to be smarter and possibly even take semantic versioning into consideration even when version ranges are not used. In my opinion, the documentation is spread out and not very clear. I think the main difference, though, is how conflicts are resolved between two dependencies, not between your project and dependency. So the first rule should still apply.