From 9bd85df19483997ceb944937c5b3c6dad6492db6 Mon Sep 17 00:00:00 2001 From: Haroon Khan Date: Mon, 13 Jun 2022 20:31:44 +0100 Subject: [PATCH] [JAVA-9046] Fix build for Gradle 7.x --- gradle/gradle-fat-jar/build.gradle | 13 +++++++------ gradle/gradle-fat-jar/settings.gradle | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 gradle/gradle-fat-jar/settings.gradle diff --git a/gradle/gradle-fat-jar/build.gradle b/gradle/gradle-fat-jar/build.gradle index 6afad80652..70d1b998db 100644 --- a/gradle/gradle-fat-jar/build.gradle +++ b/gradle/gradle-fat-jar/build.gradle @@ -3,7 +3,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' + classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.3' } } @@ -20,7 +20,7 @@ jar { } from { - configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } } @@ -30,12 +30,13 @@ task customFatJar(type: Jar) { attributes 'Main-Class': 'com.baeldung.fatjar.Application' } baseName = 'all-in-one-jar' - from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } with jar } dependencies{ - compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' - compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25' -} \ No newline at end of file + implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' + implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25' +} diff --git a/gradle/gradle-fat-jar/settings.gradle b/gradle/gradle-fat-jar/settings.gradle new file mode 100644 index 0000000000..5abc556780 --- /dev/null +++ b/gradle/gradle-fat-jar/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'gradle-fat-jar'