Project depending on a Maven “child” (sub) project with dependencyManagement at parent


My (new) Gradle project depends on a project (via maven repository) that is built and deployed by Maven and is a child of a parent Maven project with many subprojects. Notice that I only care about one little subproject there, nothing else from that parent.

Trouble is, Gradle walks up the Maven project tree and when it sees the “dependencyManagement” in parent pom instead of treating it for what it is - list of “approved versions” of dependencies for any and all subprojects of that parent, it actually assumes that they are ALL actual dependencies of the child/subproject I care about… And that brings waaaay too much stuff into my Gradle project.

I am presently working around by explicitly excluding all those dependencies I presently know are not presently (again) not needed, but I don’t want to do that as that would mean that I have to keep up my project essentially in sync with ALL projects from that parent.

This is with Gradle 1.6. I MAY have some (little) level of influence on how those Maven projects are structured but preferably such a thing would not be needed and I could somehow tell Gradle to behave as it should… Is there a way?

Please help!

Note: also asked at

(Peter Niederwieser) #2

I haven’t heard of Gradle interpreting the ‘dependencyManagement’ section as actual dependencies before. My best guess is that something is wrong with the POM and/or parent POM, but without seeing them it’s hard to say.

PS: Please don’t double-post here and on Stack Overflow.

(Peter Niederwieser) #3

I’ve just tried to reproduce with “org.springframework:spring-core:3.1.4.RELEASE” (which declares “org.springframework:spring-parent:3.1.4.RELEASE” as its parent), but it works as expected. To investigate further, I’d need a self-contained reproducible example.


I downloaded these POMs and while cleaning them up to make an example I found that in that parent’s huge POM there are dependencies applied to all subprojects. Hence that was the real problem. Sorry for the inconvenience caused.