This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit e5f0da0fe8b57e388dcf86f1d1cfaa417cd7697f
Author: Paul King <[email protected]>
AuthorDate: Thu Apr 14 19:11:50 2022 +1000

    remove duplicate entries in jars warnings
---
 build.gradle                                       |  3 ++-
 .../src/main/groovy/org.apache.groovy-base.gradle  | 27 +++++++++++-----------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/build.gradle b/build.gradle
index 18246e15f2..66164b88ac 100644
--- a/build.gradle
+++ b/build.gradle
@@ -183,7 +183,7 @@ configurations {
 
 allprojects {
     tasks.withType(AbstractCopyTask).configureEach {
-        it.duplicatesStrategy = DuplicatesStrategy.WARN
+        it.duplicatesStrategy = DuplicatesStrategy.FAIL
     }
 }
 
@@ -198,6 +198,7 @@ tasks.named('jar') {
         from("$projectDir/notices/NOTICE-JARJAR")
         rename '^([A-Z]+)-([^.]*)', '$1'
     }
+    exclude '**/package-info.class'
 }
 
 
diff --git a/buildSrc/src/main/groovy/org.apache.groovy-base.gradle 
b/buildSrc/src/main/groovy/org.apache.groovy-base.gradle
index 2f1ef85ba0..06b3719779 100644
--- a/buildSrc/src/main/groovy/org.apache.groovy-base.gradle
+++ b/buildSrc/src/main/groovy/org.apache.groovy-base.gradle
@@ -149,25 +149,26 @@ tasks.withType(AbstractArchiveTask) {
     reproducibleFileOrder = true
 }
 
-tasks.withType(Jar).configureEach {
+tasks.withType(Jar).configureEach {jar ->
     metaInf {
-        if (file("${projectDir}/LICENSE").exists()) {
-            from "${projectDir}/LICENSE"
-        } else {
-            from("${rootProject.projectDir}/licenses/LICENSE-BASE") {
-                rename 'LICENSE-BASE', 'LICENSE'
+        if (jar.name == 'sourcesJar') {
+            if (file("${projectDir}/LICENSE").exists()) {
+                from "${projectDir}/LICENSE"
+            } else {
+                from("${rootProject.projectDir}/licenses/LICENSE-BASE") {
+                    rename 'LICENSE-BASE', 'LICENSE'
+                }
             }
-        }
-        if (file("${projectDir}/NOTICE").exists()) {
-            from "${projectDir}/NOTICE"
-        } else {
-            from("${rootProject.projectDir}/notices/NOTICE-BASE") {
-                rename 'NOTICE-BASE', 'NOTICE'
+            if (file("${projectDir}/NOTICE").exists()) {
+                from "${projectDir}/NOTICE"
+            } else {
+                from("${rootProject.projectDir}/notices/NOTICE-BASE") {
+                    rename 'NOTICE-BASE', 'NOTICE'
+                }
             }
         }
         from generateReleaseInfo
     }
-    exclude '**/package-info.class'
 }
 
 tasks.register("jarjar", JarJarTask) {

Reply via email to