Good solution Rolf. You can make it a little more concise though…
task launcherJar(type: Jar) {
appendix = "launcher"
manifest {
attributes "Class-Path": configurations.runtime.files*.name.join(" ")
}
}
startScripts {
// clear up the classpath because the launcher jar has it.
classpath = launcherJar.outputs.files
}
Gradle can work out the task dependencies from that.