The solution is to add a configuration in myWebApp that resolves to a directory containing the exploded web application.
In “myWebApp”, build.gradle:
plugins {
id 'war'
id 'eclipse'
}
configurations {
explodedWebApp
}
dependencies {
// snip
}
war {
archiveFileName = 'myWebApp.war'
}
task explodeWar(type: Sync) {
into "$buildDir/exploded/myWebApp"
with war
}
artifacts {
explodedWebApp file("$buildDir/exploded"), { builtBy explodeWar }
}
Then, in distribution’s build.gradle, change the dependencies
to refer to the explodedWebApp
configuration:
dependencies {
warFiles project(path: ':myWebApp, configuration: 'explodedWebApp')
}
The resulting distribution now contains the exploded web application in somedirectory/webapps