Add fatJar gradle task to create a single executable jar file

This commit is contained in:
AsamK 2021-10-27 20:59:02 +02:00
parent 1fae09433d
commit f884175748
2 changed files with 21 additions and 3 deletions

View file

@ -65,3 +65,17 @@ tasks.withType<Jar> {
)
}
}
task("fatJar", type = Jar::class) {
archiveBaseName.set("${project.name}-fat")
exclude(
"META-INF/*.SF",
"META-INF/*.DSA",
"META-INF/*.RSA",
"META-INF/NOTICE",
"META-INF/LICENSE",
"**/module-info.class"
)
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
with(tasks.jar.get() as CopySpec)
}