You mean a Uber Jar or Fat Jar? The moment one of your dependencies is signed you get into trouble, you can pack all dependencies in one ZIP archive and have a single (executable) JAR in the root of the archive.
tasks.jar {
manifest {
attributes(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
"Class-Path" to configurations.runtimeClasspath.files.map({ "${it.name}" }).joinToString(prefix = "lib/", separator = " lib/"),
"Main-Class" to "com.foobar.Main"
)
}
}
tasks.register<Zip>("dist") {
dependsOn(tasks["jar"])
from(tasks.jar.get().archivePath)
from(configurations.runtimeClasspath) {
into("lib")
}
}