Skip to content

Restore buildConfiguration() callback in deprecated PluginDescriptorBuilder.build() methods#11869

Draft
gnodet wants to merge 1 commit intomasterfrom
navy-spoon
Draft

Restore buildConfiguration() callback in deprecated PluginDescriptorBuilder.build() methods#11869
gnodet wants to merge 1 commit intomasterfrom
navy-spoon

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Mar 31, 2026

Summary

  • Restore buildConfiguration() callback in the deprecated build(Reader, String) and build(InputStream, String) methods
  • The [MNG-7947] refactoring inadvertently bypassed this overridable method, breaking subclasses like EnhancedPluginDescriptorBuilder in maven-plugin-tools
  • The legacy code path now detects the namespace (PLUGIN 2.0.0 vs legacy), and calls buildConfiguration() for the legacy format

Context

This fixes the root cause of apache/maven-plugin-tools#806 and unblocks apache/maven-plugin-tools#1091 (Maven 4 CI).

The build(Reader, String) method was changed from:

return build(source, buildConfiguration(reader));

to:

return build(() -> reader, source);

which skips the buildConfiguration() callback entirely. Subclasses that override buildConfiguration() to intercept the parsed configuration (e.g., to extract requiredJavaVersion) get a null field and NPE.

Test plan

  • mvn compile test passes in compat/maven-plugin-api
  • Full CI
  • Verify maven-plugin-tools reporting ITs pass with this Maven build

🤖 Generated with Claude Code

The MNG-7947 refactoring changed the deprecated build(Reader, String) and
build(InputStream, String) methods to delegate to the new
build(ReaderSupplier/StreamSupplier, String) methods, which bypassed the
overridable buildConfiguration() method. This broke subclasses (such as
EnhancedPluginDescriptorBuilder in maven-plugin-tools) that override
buildConfiguration() to intercept the parsed configuration.

Restore the buildConfiguration() callback in the legacy code path while
still supporting PLUGIN 2.0.0 namespace detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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