I've got a modular Java project that combines libraries and CLI tools:
- cli-tools/
- create-patch
- find-conflicts
- modules/
- core
- analysis
I'm trying to create a combined distribution from the cli-tools project which contains all the dependency jars and all the launch scripts generated by the application plugin. I've got the build dependencies working, and my local jars are being included, but the launch scripts are not being included, and neither is anything from the runtimeClasspaths. My logging statement shows no plugins on any of the subprojects, even though their tasks are being executed, so maybe my method of checking for plugins is wrong?
// cli-tools/build.gradle.kts:
tasks.named("distZip").configure {
subprojects.forEach {
dependsOn(it.path.plus(":startScripts"))
}
}
distributions {
main {
distributionBaseName.set("patch-tools")
contents {
project.subprojects.forEach { sub ->
val subLibs = sub.buildDir.resolve("libs")
if (subLibs.exists())
into("lib") {
from(subLibs)
}
sub.logger.info("plugins of {}: {}", sub.name, sub.plugins)
if (sub.pluginManager.hasPlugin("application")) {
into("lib") {
from(sub.configurations.findByName("runtimeClasspath"))
}
into("bin") {
from(sub.buildDir.resolve("scripts"))
}
}
}
}
}
}
How can I get this working so launch scripts and transitive dependencies are included in the distribution?