Clarify relationship between duplicatesStrategy and ResourceTransformers - #2162
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Clarifies how Gradle’s duplicatesStrategy interacts with Shadow’s resource transforming/relocating, documenting that duplicate handling happens in Gradle’s CopySpec layer before Shadow’s ResourceTransformer processing.
Changes:
- Expands the NOTE explaining precedence of
duplicatesStrategyover transforming/relocating. - Adds a concrete example showing how
DuplicatesStrategy.EXCLUDEcan prevent transformer-based merging. - Documents the warning behavior emitted when a transformer matches a resource while
duplicatesStrategyisEXCLUDE.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Goooler
commented
Aug 9, 2026
Co-authored-by: Zongle Wang <wangzongler@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
docs/configuration/merging/README.md:92
- The documented warning output omits the third line that Shadow actually logs (the "See … for more details" line). Including it (or noting the snippet is truncated) keeps the docs aligned with the real build output.
'META-INF/services/foo' is matched by com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer but its DuplicatesStrategy is EXCLUDE — duplicates may be silently dropped before the transformer processes them.
Set it to INCLUDE or WARN to ensure all duplicates are processed by the transformer.
docs/configuration/merging/README.md:61
- The NOTE explains that
duplicatesStrategyruns before Shadow's transformers, but the phrase "duplicate filtering" is a bit inaccurate because most strategies (e.g.,WARN/FAIL/INCLUDE) aren’t filtering duplicates; they’re handling them. Rewording avoids implyingduplicatesStrategyalways drops inputs.
Because `ShadowJar` is a subclass of Gradle's `AbstractCopyTask`, duplicate filtering configured via
`duplicatesStrategy` is performed at Gradle's `CopySpec` processing layer **before** entries are passed to Shadow's
internal [`ResourceTransformer`][ResourceTransformer] engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2026.