Skip to content

Fix mvnup plugin upgrade for plugins inherited in build/plugins#12157

Closed
gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:productive-gymnast
Closed

Fix mvnup plugin upgrade for plugins inherited in build/plugins#12157
gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:productive-gymnast

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 26, 2026

Summary

  • When a remote parent POM declares a plugin with an explicit version in <build><plugins> (not <pluginManagement>), mvnup's plugin upgrade strategy now adds the plugin to both <pluginManagement> and <build><plugins> in the child project
  • Previously, only a <pluginManagement> entry was added, which is insufficient because the parent's <plugins> version takes precedence over the child's <pluginManagement>
  • This fixes the scenario described in the ratis-hadoop-projects issue where maven-enforcer-plugin:1.4.1 inherited from a parent's <plugins> section caused NoSuchMethodError in Maven 4

Test plan

  • New test shouldAddDirectBuildPluginsOverrideForInheritedPlugins verifies both pluginManagement and build/plugins entries are added for inherited plugins
  • New test shouldNotDuplicatePluginInBuildPluginsWhenAlreadyDeclared verifies no duplicates when plugin is already locally declared
  • All 29 existing + new PluginUpgradeStrategy tests pass

🤖 Generated with Claude Code

When a remote parent POM declares a plugin with an explicit version in
<build><plugins>, adding a <pluginManagement> entry in the child is
insufficient to override it. The parent's <plugins> version takes
precedence over the child's <pluginManagement>.

Now the plugin upgrade strategy adds plugins to both <pluginManagement>
(for downstream children) and <build><plugins> (to override the
inherited version) when the effective model shows outdated plugins in
the build/plugins section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented May 27, 2026

Claude Code on behalf of Guillaume Nodet

Closing in favor of a more precise implementation that only adds direct <plugins> entries when the parent's version is truly locked (explicit version in <plugins>, not from <pluginManagement>). The previous approach added unnecessary <plugins> entries even when a <pluginManagement> override alone would suffice.

@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented May 27, 2026

Claude Code on behalf of Guillaume Nodet

Superseded by #12165, which uses a more precise approach — comparing effective versions in build/plugins vs build/pluginManagement/plugins upfront to determine the correct override location, avoiding unnecessary <plugins> entries.

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.

1 participant