cli: Use dedicated shadow plugin for building fat jar

'gradle shadowJar' can be used to build a fat jar
'gradle jar' now only builds slim jar
This commit is contained in:
Paul Schaub 2022-07-08 18:26:45 +02:00
parent 7169b369b3
commit b217b8b218
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
2 changed files with 6 additions and 4 deletions

View File

@ -13,14 +13,14 @@ PGPainless-CLI is an implementation of the [Stateless OpenPGP Command Line Inter
It plugs `pgpainless-sop` into `sop-java-picocli`.
## Build
To build an executable, `gradle jar` should be sufficient. The resulting jar file can be found in `pgpainless-sop/build/libs/`.
To build an executable, `gradle shadowJar` should be sufficient. The resulting jar file can be found in `pgpainless-cli/build/libs/`.
## Execute
The jar file produced in the step above is executable as is.
```
java -jar pgpainless-cli-XXX.jar help
java -jar pgpainless-cli-XXX-all.jar help
```
Alternatively you can use the provided `./pgpainless-cli` script to directly build and execute PGPainless' Stateless Command Line Interface from within Gradle.

View File

@ -4,6 +4,7 @@
plugins {
id 'application'
id "com.github.johnrengelman.shadow" version "6.1.0"
}
def generatedVersionDir = "${buildDir}/generated-version"
@ -51,7 +52,7 @@ mainClassName = 'org.pgpainless.cli.PGPainlessCLI'
application {
mainClass = mainClassName
}
/**
jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
manifest {
@ -66,6 +67,7 @@ jar {
exclude "META-INF/*.RSA"
}
}
*/
run {
// https://stackoverflow.com/questions/59445306/pipe-into-gradle-run
@ -76,4 +78,4 @@ run {
}
}
tasks."jar".dependsOn(":pgpainless-core:assemble", ":pgpainless-sop:assemble")
// tasks."jar".dependsOn(":pgpainless-core:assemble", ":pgpainless-sop:assemble")