Non Java Project Cannot resolve dependencies from java subproject when dependencyManagement block involved

(Peter Kahn) #1

How can I get a non java docker subproject copy all dependencies from a java project even when dockerProject cannot understand depdencyManagement?

In our top level project we have a configure block for java projects which uses a dependencyManagement block

configure(javaProjects) {
         dependencyManagement {
            imports {
                mavenBom '

We have a docker project that wants to copy all the jars from a java project and place them into a container. The docker project attempts the following;

dependencies {
    runtime project(':a-java-project')
task stageJars(type: Copy) {
    into "build/jars"
    from configurations.runtime


This fails as when it attempts to understand the java subproject’s dependencies it lacks the dependencyManagement augmenter/filter and reports dependencies like:

  +--- org.springframework.boot:spring-boot-starter-web: FAILED
  +--- org.springframework.boot:spring-boot-starter-jetty: FAILED

This results in errors like:

  Could not find org.springframework.boot:spring-boot-starter-actuator:.

No version, just a dot.

I don’t understand how I can get the built java-subproject to report its actual classpath used during compilation or required for runtime to this nonjava project. I guess, I can query the project obtain and pull the data with the details but I feel like there must be an easier way to do this.

Please let me know if you know of an easier way to get a list of dependencies and their locations - or the resolved classpath of a subproject.