Skip to content

[Forward port] mvnup: skip dedup inside plugin <configuration> elements - #12614

Merged
gnodet merged 2 commits into
masterfrom
forward-port/mvnup-dedup-configuration
Jul 29, 2026
Merged

[Forward port] mvnup: skip dedup inside plugin <configuration> elements#12614
gnodet merged 2 commits into
masterfrom
forward-port/mvnup-dedup-configuration

Conversation

@gnodet

@gnodet gnodet commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Forward port of #12582 (maven-4.0.xmaster).

  • Use resource filtering (${maven-version}) for the mng-12534 IT plugin fixture so the version tracks the build automatically
  • Skip deduplication inside plugin <configuration> elements in DuplicateElementStrategy, fixing builds that use repeated same-named elements as list entries (e.g. <arg>, <module>, <exclude>)

Test plan

🤖 Generated with Claude Code

Move the plugin POM to src/test/resources-filtered/ (which already
has <filtering>true</filtering> in the core-it-suite build) and
replace the hardcoded version with ${maven-version}, defined in the
ITs parent POM.

Maven resource filtering resolves the token at build time, so the
version always matches the Maven build under test — including during
the release process, where the release plugin bumps the version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Clean forward port of #12582. The fix correctly skips deduplication inside plugin <configuration> elements in DuplicateElementStrategy, preventing the tool from silently removing valid list entries like <arg>, <module>, <exclude>. The behavioral distinction between FREEFORM_ELEMENTS (skip entire subtree) and LIST_CONTAINER_ELEMENTS (skip dedup but recurse children) is correct and well-motivated.

The IT fixture move from resources/ to resources-filtered/ properly leverages the existing filtering configuration, replacing the hardcoded 4.1.0-SNAPSHOT with ${maven-version} so the fixture version tracks the build automatically.

The 6 new tests in PluginConfigurationSkippingTests provide excellent coverage of real-world scenarios (compiler args, exec plugin arguments, checkstyle modules/properties, mixed POM-level dedup + configuration preservation, RAT excludes, and m2e lifecycle mapping).

One minor observation: the FREEFORM_ELEMENTS constant is declared mid-class (line 150) while the analogous LIST_CONTAINER_ELEMENTS is at the top (line 73) — grouping them together would improve readability. Not blocking.

(Posting as COMMENT because GitHub does not allow self-approval — this would otherwise be an APPROVE.)

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
gnodet force-pushed the forward-port/mvnup-dedup-configuration branch from c1c2ff3 to d214fa3 Compare July 29, 2026 16:00

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-reviewed after new commit (a9c4f26 — use resource filtering for IT plugin mavenVersion). The change is clean: moves plugin/pom.xml from resources/ to resources-filtered/ to leverage the existing <filtering>true</filtering> configuration, replacing the hardcoded 4.1.0-SNAPSHOT with ${maven-version}. This eliminates a version that would go stale during releases. The main fix (skip dedup inside <configuration>) remains correct. LGTM ✅

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

@gnodet gnodet added the bug Something isn't working label Jul 29, 2026
@gnodet gnodet self-assigned this Jul 29, 2026
@gnodet gnodet added this to the 4.1.0 milestone Jul 29, 2026
@gnodet
gnodet merged commit ace005b into master Jul 29, 2026
23 checks passed
@gnodet
gnodet deleted the forward-port/mvnup-dedup-configuration branch July 29, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant