From dae40e866f0055900efa656741900c05108f9a44 Mon Sep 17 00:00:00 2001 From: Johannes Hiry Date: Wed, 8 Sep 2021 13:46:37 +0200 Subject: [PATCH 1/5] switch to shadowJar + fmt (cherry picked from commit 62aede905465fc6389cff404509b501a053d5c20) --- build.gradle | 13 +++++++++++-- gradle/scripts/fatJar.gradle | 13 ------------- 2 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 gradle/scripts/fatJar.gradle diff --git a/build.gradle b/build.gradle index 6dfe09a..ef30e6e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer + plugins { id "com.jfrog.artifactory" version "4.24.20" //artifactory support id 'groovy' // groovy support @@ -11,6 +13,7 @@ plugins { id 'com.github.onslip.gradle-one-jar' version '1.0.6' // pack a self contained jar id 'jacoco' // java code coverage plugin id "org.sonarqube" version "3.3" // sonarqube + id "com.github.johnrengelman.shadow" version "7.0.0" // fat jar } ext { @@ -37,7 +40,6 @@ apply from: scriptsLocation + 'spotbugs.gradle' apply from: scriptsLocation + 'spotless.gradle' apply from: scriptsLocation + 'modernizer.gradle' apply from: scriptsLocation + 'checkJavaVersion.gradle' -apply from: scriptsLocation + 'fatJar.gradle' apply from: scriptsLocation + 'tests.gradle' apply from: scriptsLocation + 'jacoco.gradle' // jacoco java code coverage apply from: scriptsLocation + 'sonarqube.gradle' // sonarqube config @@ -125,7 +127,7 @@ publishing { from components.java artifact sourcesJar artifact javadocJar - artifact fatJar + artifact shadowJar versionMapping { usage('java-api') { fromResolutionOf('runtimeClasspath') @@ -166,3 +168,10 @@ run { // Gradle uses an empty Input as default, leading to a non-blocking behaviour and thus an immediate shutdown standardInput = System.in } + +shadowJar { + transform(AppendingTransformer) { + resource = 'reference.conf' + } + zip64 = true +} diff --git a/gradle/scripts/fatJar.gradle b/gradle/scripts/fatJar.gradle deleted file mode 100644 index 5f3823d..0000000 --- a/gradle/scripts/fatJar.gradle +++ /dev/null @@ -1,13 +0,0 @@ -tasks.register('fatJar', Jar){ - getArchiveClassifier().set('fat') - manifest { - attributes( - 'Main-Class': mainClass - ) - } - //baseName = project.archivesBaseName + '-fat' - from { - configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } - } - with jar -} From 14483ee16f7b19c6401bc103de18d734ec975ff8 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 30 Mar 2022 15:11:11 +0200 Subject: [PATCH 2/5] add shadowjar support --- build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index ef30e6e..19cb8b4 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ plugins { id 'com.github.onslip.gradle-one-jar' version '1.0.6' // pack a self contained jar id 'jacoco' // java code coverage plugin id "org.sonarqube" version "3.3" // sonarqube - id "com.github.johnrengelman.shadow" version "7.0.0" // fat jar + id "com.github.johnrengelman.shadow" version "6.1.0" // fat jar } ext { @@ -34,7 +34,6 @@ defaultTasks 'build' sourceCompatibility = javaVersion targetCompatibility = javaVersion - apply from: scriptsLocation + 'pmd.gradle' apply from: scriptsLocation + 'spotbugs.gradle' apply from: scriptsLocation + 'spotless.gradle' @@ -153,7 +152,7 @@ tasks.withType(JavaCompile) { } application { - mainClassName = mainClass + mainClassName = "edu.ie3.tools.Main" } jar { From 1f9df5b0098135f0dbeca8f7068fb7968da07a98 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 31 Mar 2022 09:12:56 +0200 Subject: [PATCH 3/5] fix jar logging --- build.gradle | 2 ++ src/main/java/edu/ie3/tools/Converter.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 19cb8b4..db548de 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer +import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer plugins { id "com.jfrog.artifactory" version "4.24.20" //artifactory support @@ -172,5 +173,6 @@ shadowJar { transform(AppendingTransformer) { resource = 'reference.conf' } + transform(Log4j2PluginsCacheFileTransformer) zip64 = true } diff --git a/src/main/java/edu/ie3/tools/Converter.java b/src/main/java/edu/ie3/tools/Converter.java index ed63067..48f9fe1 100644 --- a/src/main/java/edu/ie3/tools/Converter.java +++ b/src/main/java/edu/ie3/tools/Converter.java @@ -77,7 +77,7 @@ public void run() { printInit(); validateConnectionProperties(); convert(); - } else logger.info("Converter is already running."); + } else logger.info("Converter is already running or you can't acquire a lock (in which case you might try sudo)."); } /** Validates Connection Properties from user input */ From 6e7561535d174b878e7b8a481f364e6e075f54b7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 3 Apr 2022 18:15:09 +0200 Subject: [PATCH 4/5] fmt --- src/main/java/edu/ie3/tools/Converter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/ie3/tools/Converter.java b/src/main/java/edu/ie3/tools/Converter.java index f89d580..5f73699 100644 --- a/src/main/java/edu/ie3/tools/Converter.java +++ b/src/main/java/edu/ie3/tools/Converter.java @@ -77,7 +77,9 @@ public void run() { printInit(); validateConnectionProperties(); convert(); - } else logger.info("Converter is already running or you can't acquire a lock (in which case you might try sudo)."); + } else + logger.info( + "Converter is already running or you can't acquire a lock (in which case you might try sudo)."); } /** Validates Connection Properties from user input */ From 381879e54b3104878b14c4cde74559789eaf8a56 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 5 Apr 2022 09:13:50 +0200 Subject: [PATCH 5/5] bump to work with java 17 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2125deb..66ba4ba 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ plugins { id 'com.github.onslip.gradle-one-jar' version '1.0.6' // pack a self contained jar id 'jacoco' // java code coverage plugin id "org.sonarqube" version "3.3" // sonarqube - id "com.github.johnrengelman.shadow" version "6.1.0" // fat jar + id "com.github.johnrengelman.shadow" version "7.1.2" // fat jar } ext {