Hi,
I’m trying to make a multiproject build and create a WAR file with all dependencies (both internal and external).
If I just use the war-plugin out of the box, the main project only gets the jar files from the subprojects - not the jar files from the subprojects external dependencies.
To achieve that I had to add something like the following:
war {
classpath project(’:services:personService’).configurations.default
classpath project(’:api’).configurations.default
classpath project(’:shared’).configurations.default }
…which seems like a hack.
Can anyone point me in the right direction?
See the full build.gradle below.
Kind regards Anders Viskum
apply plugin: ‘war’
subprojects {
apply plugin: ‘java’
group = ‘org.gradle.sample’
version = ‘1.0’
repositories {
mavenCentral()
}
dependencies {
compile “junit:junit:4.8.1”
} }
project(’:api’) {
dependencies {
compile project(’:shared’)
} }
project(’:services:personService’) {
dependencies {
compile project(’:shared’), project(’:api’)
} }
dependsOnChildren()
dependencies {
runtime project(’:services:personService’) }
war {
classpath project(’:services:personService’).configurations.default
classpath project(’:api’).configurations.default
classpath project(’:shared’).configurations.default }