From f8841757482485336005d3b4f15c8c8c17a2e731 Mon Sep 17 00:00:00 2001 From: AsamK Date: Wed, 27 Oct 2021 20:59:02 +0200 Subject: [PATCH] Add fatJar gradle task to create a single executable jar file --- README.md | 10 +++++++--- build.gradle.kts | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b041b4a0..67bbb75a 100644 --- a/README.md +++ b/README.md @@ -81,15 +81,19 @@ dependencies. If you have a recent gradle version installed, you can replace `./ ./gradlew build - 3a. Create shell wrapper in *build/install/signal-cli/bin*: + 2a. Create shell wrapper in *build/install/signal-cli/bin*: ./gradlew installDist - 3b. Create tar file in *build/distributions*: + 2b. Create tar file in *build/distributions*: ./gradlew distTar - 3c. Compile and run signal-cli: + 2c. Create a fat tar file in *build/libs/signal-cli-fat*: + + ./gradlew fatJar + + 2d. Compile and run signal-cli: ./gradlew run --args="--help" diff --git a/build.gradle.kts b/build.gradle.kts index 481f2668..eb4b18fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,3 +65,17 @@ tasks.withType { ) } } + +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) +} -- 2.50.1