Skip AddAnnotationProcessor when processor already in effective POM via ancestor#6759
Conversation
…ia ancestor When an in-reactor parent POM inherits the annotation processor configuration from a parent outside the reactor (present in the effective POM but not in own XML), the recipe would previously add a redundant entry, duplicating what the ancestor already provides. Fix: in the scanner phase, compare `ResolvedPom.getPlugins()/getPluginManagement()` (the merged effective lists including ancestor POMs) against `Pom.getPlugins()/getPluginManagement()` (the current POM's own XML only). If the processor is in the effective POM but not in the own XML, mark the path as already-configured and skip it in the visitor phase. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The CI failure in Evidence:
This appears to be a pre-existing flaky test. Could a maintainer re-run the CI? |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Local test results: All 23 CI flakiness confirmation: The second CI run failed with a completely different error — |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the fix & validation @mcebanupgrade ! Any reason your PR is still marked as draft? Can it be reviewed and merged? |
|
Hi @timtebeek ! |
Summary
AddAnnotationProcessorwould add a redundant annotation processor entry when an in-reactor parent POM inherits the configuration from a parent outside the reactor. The processor was present in the effective POM (via merged ancestor configs) but not in the in-reactor parent's own XML, causing a duplicate to be written.Root cause: The scanner only tracked reactor topology — it had no visibility into whether the annotation processor was already inherited from an external ancestor via the effective POM.
Fix:
ResolvedPom.getPlugins()/getPluginManagement()(merged effective lists from all ancestors) againstPom.getPlugins()/getPluginManagement()(current POM's own XML only)alreadyConfiguredInEffectivePomPathsalreadyConfiguredInEffectivePomPathsAdded
hasAnnotationProcessor(List<Plugin>)andisMatchingProcessor(JsonNode)helpers for the effective POM check, using JacksonJsonNodetraversal ofPlugin.getConfiguration()(consistent with howResolvedPomexposes plugin config).Test plan
EffectivePomCheck.doesNotAddWhenAlreadyInEffectivePomViaAncestortest inAddAnnotationProcessorTest: 3-level hierarchy where grandparent has the processor inpluginManagement, intermediate parent inherits it via effective POM but has no own XML config — intermediate parent must NOT be modified🤖 Generated with Claude Code