Reputation: 3680
I have a parent-pom.xml which declares a dependency A v1.0 which transitively depends on B v1.0 in <dependencyManagement>
section.
My child-pom.xml references A v1.0 in <dependencies>
section. However, the code of the child project also uses classes from dependency B v1.0.
The code of the child project compiles and runs without explicitly referencing B v1.0 because Maven resolves it transitively via A v1.0. What are the downsides of not explicitly referencing B v1.0 in <dependencies>
section?
Upvotes: 3
Views: 617
Reputation: 11909
Well, suppose you want to upgrade A to v1.1 and that this version does no longer use B, or use B v2.0 which has a different API. Doing so you'll break your code as it rely on something that does not exist anymore (B v1.0).
On the other side, if you had explicitly specified that your were using B in your child project then you would end up with one of the two options:
Upvotes: 1