Gradle subProject configuration dependencies not being add to war


(RJ Ewing) #1

I have a main project that depends on 2 subProjects. All 3 projects have a custom configuration called server.

When I have the following war task, only the dependencies in the main project configuration.server are being added to the war.

task fatWar(type: War) {
    archiveName = "arms-fat.war"
    classpath configurations.server
    classpath configurations.compile
}

How do I add the subProject server configuration dependencies to the war?

Here are some snippets of my build files for context.

rootProject build.gradle

configurations {
    server
}
dependencies {
    server 'org.glassfish.jersey.media:jersey-media-multipart:2.22.2'
    ...
}
task fatWar(type: War) {
    archiveName = "arms-fat.war"
    classpath configurations.server
    classpath configurations.compile
}

subProject build.gradle

configurations {
    server
}
dependencies {
    server 'mysql:mysql-connector-java:5.1.38'
    ...
}

When I run the fatWar task, the mysql-connector.jar, among others are not bundled in the war