distributions {
main {
baseName = "my-app"
contents {
with generateDistCopySpec()
}
}
}
which calls
generateDistCopySpec(String distPath = '', String confPath = 'etc') {
copySpec {
into(distPath) {
// app lib
into('app-lib') {
from configurations.appLib
}
....
// apps
apps.collect { with appCopySpec(it, distPath, confPath, filterFile) }
}
This definition again, avoids the warning but does not create the proper task dependency linkage to trigger the distTar task in subprojects if I’m using the tarTree() call to unpack the archive, causing a file not found when the distribution plugin tries to package the root project. Without the tarTree() in the copyspec, it’s resolved correctly and the distTar task of subprojects runs correctly.
subprojects have the artifact i’m consuming defined in the root buildscript in a subprojects {} block
configurations {
providedCompile
tarball
}
distributions {
main {
contents {
exclude "*.properties"
from configurations.runtimeClasspath - configurations.providedCompile
from tasks.withType(Jar)
into "lib"
}
}
}
artifacts {
tarball(distTar)
}
sourceSets {
main.compileClasspath += configurations.providedCompile
}
By declaring a configuration per “app” (subproject) with a single depenency on the subproject tarball artifact i want to unpack, i am able to avoid that warning, the issue being that if I use from(tarTree(configurations.getByName(…).singleFile)) form (which is a configuration defined in the root project, not cross project, the dependency on the distTar task is not calculated by Gradle. Using from(configurations.getByName(…)) does set up the dependency relationship correctly but that will just pull in the archive without unpacking it.
Rather than using Copy tasks in subprojects, i’m relying on the distribution plugin to generate the distribution archives. Are you suggesting I use copy directly?