Skip to content

Migrate lifecycle mapping providers to use PluginVersions directly - #13138

Merged
gnodet merged 1 commit into
apache:masterfrom
gnodet:fix/migrate-subclasses-to-plugin-versions
Sep 15, 2026
Merged

gnodet merged 1 commit into
apache:masterfrom
gnodet:fix/migrate-subclasses-to-plugin-versions

Conversation

@gnodet

@gnodet gnodet commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #13080.

#13080 introduced PluginVersions and marked the *_PLUGIN_VERSION constants in AbstractLifecycleMappingProvider as @Deprecated(since = "4.1.0", forRemoval = true), but the subclasses were never updated — they still reference the deprecated inherited constants.

The 4.0.x backport (#13137) did it correctly: it migrated all subclasses to PluginVersions.* directly and removed the deprecated constants from AbstractLifecycleMappingProvider entirely.

This PR brings master in line with the backport:

  • Update all *LifecycleMappingProvider subclasses to reference PluginVersions.* directly
  • Remove the now-unused deprecated *_PLUGIN_VERSION constants from AbstractLifecycleMappingProvider

@gnodet gnodet added the enhancement New feature or request label Sep 15, 2026

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The migration is mechanically correct — all 8 subclasses updated, deprecated constants removed, PluginVersions.* usage is consistent.

One pre-existing issue is worth fixing in this cleanup PR since it's in the same file being touched.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Remove the deprecated *_PLUGIN_VERSION constants from
AbstractLifecycleMappingProvider and update all subclasses to reference
PluginVersions.* constants directly, as was done in the 4.0.x backport
(apache#13137).

The deprecated constants were introduced as a bridge in apache#13080 but the
subclasses were never updated to stop using them. This completes the
migration.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review after rebase (e602a0e).

The new commits look correct: moving // START SNIPPET: versions / // END SNIPPET: versions markers into PluginVersions.java and updating the .md.vm snippet reference accordingly is the right place — PluginVersions is the canonical source, not AbstractLifecycleMappingProvider.

The outstanding finding from the previous review (trailing comma in MavenPluginLifecycleMappingProvider) is still present and still needs to be fixed.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

"org.apache.maven.plugins:maven-resources-plugin:" + PluginVersions.RESOURCES + ":testResources",
"test-compile", "org.apache.maven.plugins:maven-compiler-plugin:" + PluginVersions.COMPILER + ":testCompile",
"test", "org.apache.maven.plugins:maven-surefire-plugin:" + PluginVersions.SUREFIRE + ":test",
"package", "org.apache.maven.plugins:maven-jar-plugin:" + PluginVersions.JAR + ":jar,",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Still unaddressed: trailing comma in goal name. The ":jar," string is a leftover from when the package phase used to bind two goals (jar + addPluginArtifactMetadata) in a single comma-separated string. addPluginArtifactMetadata was removed but the trailing comma remained. goals.split(",") on "g:a:v:jar," produces ["g:a:v:jar", ""] — the empty string becomes a LifecycleMojo with a blank goal name. It's a silent no-op today but dead weight that could confuse future diagnostics.

Suggested change
"package", "org.apache.maven.plugins:maven-jar-plugin:" + PluginVersions.JAR + ":jar,",
"package", "org.apache.maven.plugins:maven-jar-plugin:" + PluginVersions.JAR + ":jar",

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review after new push (0fe8f3c).

✅ Previous finding addressed: the trailing comma in MavenPluginLifecycleMappingProvider.java (:jar,:jar) has been fixed in this commit.

The migration is mechanically correct and complete:

  • All 8 packaging subclasses migrated from inherited *_PLUGIN_VERSION constants to direct PluginVersions.* references
  • Deprecated constants removed from AbstractLifecycleMappingProvider
  • // START SNIPPET: versions / // END SNIPPET: versions markers cleaned up
  • No logic changes, no behavioral impact

Consistent with the 4.0.x backport (#13137). LGTM.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet gnodet added this to the 4.1.0 milestone Sep 15, 2026
@gnodet
gnodet merged commit 4fda12e into apache:master Sep 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants