maven dependency vs dependencyManagement

I was trying to add some spring contract library onto classpath, however, after adding it to pom, did the refresh, and restarted the intellij all resulted in nothing.

finally realized I was putting the dependency into “`<dependencyManagement>`. section.

I’m fashionably late to this question, but I think it’s worth a clearer response than the accepted one (which is correct, but doesn’t emphasize the actual important part, which you need to deduce yourself).

In the parent POM, the main difference between the <dependencies> and <dependencyManagement> is this:

  • Artifacts specified in the <dependencies> section will ALWAYS be included as a dependency of the child module(s).
  • Artifacts specified in the <dependencyManagement> section, will only be included in the child module if they were also specified in the <dependencies> section of the child module itself. Why is it good you ask? Because you specify the version and/or scope in the parent, and you can leave them out when specifying the dependencies in the child POM. This can help you use unified versions for dependencies for child modules, without specifying the version in each child module.


source: pom.xml – Differences between dependencyManagement and dependencies in Maven – Stack Overflow


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s