Fix #12522: handle unprovisionable ProjectExecutionListeners from non-extension plugins#12528
Draft
gnodet wants to merge 2 commits into
Draft
Fix #12522: handle unprovisionable ProjectExecutionListeners from non-extension plugins#12528gnodet wants to merge 2 commits into
gnodet wants to merge 2 commits into
Conversation
Add a failing integration test that reproduces the issue where Maven picks up JSR330/Plexus extension components from plugins that are NOT configured with <extensions>true</extensions>. The test uses the tycho-bnd-plugin reproducer from the issue and verifies that running process-classes succeeds without "Unable to provision" errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-extension plugins Sisu's component discovery runs on all plugin classrealms, not just extension-marked plugins. This causes JSR330 components like ProjectExecutionListener implementations to appear in live-injected lists even when the plugin never opted in via <extensions>true</extensions>. When such components have dependencies that are not bound in Maven's container (e.g. Tycho-internal classes), lazy provisioning aborts the build with "Unable to provision" errors. Fix CompoundProjectExecutionListener to catch provisioning failures during iteration and skip unprovisionable listeners with a debug log instead of aborting the build. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #12522
When a plugin ships JSR 330 components (e.g.
ProjectExecutionListenerimplementations) but is not configured with<extensions>true</extensions>, Sisu's component discovery still registers them in the globalBeanLocator. The live-injectedList<ProjectExecutionListener>inLifecycleModuleBuilderpicks these up, and lazy provisioning fails when the component's plugin-internal dependencies (e.g. Tycho'sMavenReactorRepository) are not bound in Maven's container — aborting the build withUnable to provisionerrors.Root cause
DefaultMavenPluginManager.discoverPluginComponents()callscontainer.discoverComponents(pluginRealm, ...)for all plugins, not just extension-marked ones. This is required for mojo loading (Sisu-backedcontainer.lookup()needs the discovery), so it cannot simply be gated behindplugin.isExtensions(). However, it means ALL@Namedcomponents from any plugin realm become globally visible — including lifecycle listeners that were never intended to run as Maven extensions.Fix
Make
CompoundProjectExecutionListenerresilient to provisioning failures during iteration of the Sisu live list. Wheniterator.next()throws aProvisionException(because a non-extension plugin's component has unresolvable dependencies), the listener is skipped with a debug log instead of aborting the build.Changes
CompoundProjectExecutionListener: AddedsafeListeners()method that wraps the Sisu live-list iterator with defensive error handling, catchingRuntimeException(GuiceProvisionException) during lazy provisioningMavenITgh12522NonExtensionPluginTest: Integration test usingtycho-bnd-plugin(shipsBndProjectExecutionListeneras a@NamedJSR 330 component) to verify the build succeeds without provisioning errorsTest plan
MavenITgh12522NonExtensionPluginTestpasses — build withtycho-bnd-plugin(non-extension) completes successfullyUnable to provision: No implementation for MavenReactorRepository