Skip to content

Clarify relationship between duplicatesStrategy and ResourceTransformers - #2162

Merged
Goooler merged 5 commits into
mainfrom
g/20260809/docs-for-trans-and-strategy
Aug 9, 2026
Merged

Clarify relationship between duplicatesStrategy and ResourceTransformers#2162
Goooler merged 5 commits into
mainfrom
g/20260809/docs-for-trans-and-strategy

Conversation

@Goooler

@Goooler Goooler commented Aug 9, 2026

Copy link
Copy Markdown
Member

Refs #2026.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 duplicatesStrategy over transforming/relocating.
  • Adds a concrete example showing how DuplicatesStrategy.EXCLUDE can prevent transformer-based merging.
  • Documents the warning behavior emitted when a transformer matches a resource while duplicatesStrategy is EXCLUDE.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/configuration/merging/README.md Outdated
Comment thread docs/configuration/merging/README.md Outdated
Goooler and others added 2 commits August 9, 2026 09:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread docs/configuration/merging/README.md Outdated
Co-authored-by: Zongle Wang <wangzongler@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 duplicatesStrategy runs 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 implying duplicatesStrategy always 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.

@Goooler
Goooler merged commit 74e727e into main Aug 9, 2026
6 checks passed
@Goooler
Goooler deleted the g/20260809/docs-for-trans-and-strategy branch August 9, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants