dependencyManagement tag in Maven

One very peculiar issue I’ve run into during development is an issue where I have a parent pom.xml file and a child pom.xml file. The child pom.xml file imports the parent artifact as a dependency.

Now, when we make changes to dependencies in the parent pom.xml file, we don’t see them reflected when building the child pom.xml file, the child is still pulling in an unwanted dependency version from the parent.

What’s the issue?

Is the parent artifact being published to the local maven repository correctly? Yes it is, that’s not the issue.

The problem was that our child pom.xml had a <dependencyManagement> tag that was over-writing the changes in the parent pom. Check out this stack overflow post to learn more.

Update 9/30/21: Better explanation can be found here.

The moral of the story: Be aware of what the <dependencyManagement> tag does when debugging maven issues.

Leave a Reply

Your email address will not be published. Required fields are marked *