War does not include dependencies of project with custom configuration

I have a 2-project example, with a custom configuration in the second project, where apparently I missed something. Here’s the simplified code (only the relevant bits):

Content of projA.gradle:

apply plugin: 'java'
apply plugin: 'war'
  dependencies {
    compile project(path: ':projB', configuration: 'core')
}

Content of projB.gradle:

apply plugin: 'java'
configurations {
    // declare core configuration
    core
    // the default configuration extends the core configuration
    compile.extendsFrom(coreCompile)
}
  sourceSets {
    main {
      java {
        srcDirs = [ 'src', 'src-ext' ]
      }
    }
    core {
      java {
        srcDirs = [ 'src' ]
      }
    }
}
  dependencies {
    // dependencies of configuration "core"
    coreCompile project(':projC')
    coreCompile libs.lib1
      // Additional dependencies (added only to default configuration)
    compile project(':projD')
    compile libs.lib2
}
  // Task to build a separate jar for core
task coreJar(type: Jar) {
    classifier = 'core'
    from sourceSets.core.output
}
// declare artifact for configuration core
artifacts {
    core coreJar
}

The problem I’m having is: when I make the war of projA, its content is:

  • classes of projA - jar of projB, configuration core (verified that the jar only contains the classes defined in core configuration) - NO jars of the dependencies of projB. I was expecting to find projC.jar and lib1.jar

However, when I do the same, but change projA.gradle to using the default configuration of projB:

dependencies {
    // compile project(path: ':projB', configuration: 'core')
    compile project(path: ':projB')
}

Then I get all the dependencies in the war (projC.jar, projD.jar, lib1.jar, lib2.jar)

I’m clearly missing something in setting up my core configuration. Who can help?

Change it so ‘core’ extends from the ‘compile’ configuration. Right now core does not have any dependencies defined.