diff --git a/docs/configuration/merging/README.md b/docs/configuration/merging/README.md index 43ca7f27c..a5eb88150 100644 --- a/docs/configuration/merging/README.md +++ b/docs/configuration/merging/README.md @@ -102,8 +102,8 @@ Alternatively, you can follow these steps: Optional steps: -- Enable [`ShadowJar.failOnDuplicateEntries`][ShadowJar.failOnDuplicateEntries] to check duplicate entries in the final JAR. - This can also ensure the regressions are caught in the future. +- [`ShadowJar.failOnDuplicateEntries`][ShadowJar.failOnDuplicateEntries] is enabled by default to check duplicate entries in the final JAR. + This can also ensure the regressions are caught in the future. Disable it if you want to allow duplicate entries. - Use [Diffuse](https://github.com/JakeWharton/diffuse) to diff the JARs. Here are some examples: @@ -144,8 +144,8 @@ Here are some examples: } tasks.shadowJar { - // Optional step. - failOnDuplicateEntries = true + // Optional step: disable it if you want to allow duplicate entries. + failOnDuplicateEntries = false } ``` @@ -185,8 +185,8 @@ Here are some examples: } tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { - // Optional step. - failOnDuplicateEntries = true + // Optional step: disable it if you want to allow duplicate entries. + failOnDuplicateEntries = false } ``` diff --git a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt index 8ec8ba3c0..dc7c9b011 100644 --- a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt +++ b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt @@ -219,14 +219,14 @@ public abstract class ShadowJar : Jar() { * - Usually used with setting [getDuplicatesStrategy] to [INCLUDE] or [WARN]. * - It provides a stricter check before the JAR is created. * - * Defaults to `false`. + * Defaults to `true`. */ @get:Input @get:Option( option = "fail-on-duplicate-entries", description = "Fails build if the ZIP entries in the shadowed JAR are duplicate.", ) - public open val failOnDuplicateEntries: Property = objectFactory.property(false) + public open val failOnDuplicateEntries: Property = objectFactory.property(true) /** * Adds the [java.util.jar.Attributes.Name.MULTI_RELEASE] attribute to the manifest of the shadow diff --git a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPropertiesTest.kt b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPropertiesTest.kt index 38b38a1f6..3cda191bf 100644 --- a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPropertiesTest.kt +++ b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPropertiesTest.kt @@ -148,7 +148,7 @@ class ShadowPropertiesTest { assertThat(addMultiReleaseAttribute.get()).isTrue() assertThat(enableAutoRelocation.get()).isFalse() assertThat(enableKotlinModuleRemapping.get()).isTrue() - assertThat(failOnDuplicateEntries.get()).isFalse() + assertThat(failOnDuplicateEntries.get()).isTrue() assertThat(minimizeJar.get()).isFalse() assertThat(mainClass.orNull).isNull()