File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
docs/configuration/merging Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -397,3 +397,30 @@ Different strategies will lead to different results for `foo/bar` files in the J
397
397
- ` INCLUDE ` : The ** last** ` foo/bar ` file will be included in the final JAR (the default behavior).
398
398
- ` INHERIT ` : ** Fail** the build with an exception like ` Entry .* is a duplicate but no duplicate handling strategy has been set ` .
399
399
- ` WARN ` : The ** last** ` foo/bar ` file will be included in the final JAR, and a warning message will be logged.
400
+
401
+ ** NOTE:** The ` duplicatesStrategy ` takes precedence over transforming and relocating. If you mix the usages of
402
+ ` duplicatesStrategy ` and ` ResourceTransformer ` like below:
403
+
404
+ === "Kotlin"
405
+
406
+ ```kotlin
407
+ tasks.shadowJar {
408
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
409
+ mergeServiceFiles()
410
+ }
411
+ ```
412
+
413
+ === "Groovy"
414
+
415
+ ```groovy
416
+ tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
417
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
418
+ mergeServiceFiles()
419
+ }
420
+ ```
421
+
422
+ The ` ServiceFileTransformer ` will not work as expected because the ` duplicatesStrategy ` will exclude the duplicated
423
+ service files beforehand. However, this behavior might be what you expected for duplicated ` foo/bar ` files, preventing
424
+ them from being included.
425
+ Want ` ResourceTransformer ` s and ` duplicatesStrategy ` to work together? There is a way to achieve this, leave the
426
+ ` duplicatesStrategy ` as ` INCLUDE ` and declare a custom ` ResourceTransformer ` to handle the duplicated files.
You can’t perform that action at this time.
0 commit comments