Sitelet https://github.com/apache/maven/pull/13290
Skip to content

[MNG-8092] Only warn about extension in reactor for projects actually built - #13290

Open
UsmanEjaz10 wants to merge 1 commit into
apache:masterfrom
UsmanEjaz10:issue-8092-fix
Open

UsmanEjaz10 wants to merge 1 commit into
apache:masterfrom
UsmanEjaz10:issue-8092-fix

Conversation

@UsmanEjaz10

@UsmanEjaz10 UsmanEjaz10 commented Sep 28, 2026 •

Copy link
Copy Markdown

How & Why

  1. How it was fixed: Moved the extension validation call from build() (which ran prematurely on all initial reactor projects) into reactorDependencyGraph() right after all project trimming/exclusion steps (trimProjectsToRequest, trimSelectedProjects, trimResumedProjects, and trimExcludedProjects), evaluating only activeProjects.
  2. Why approached this way: Extension-in-reactor warnings are only valid for modules actually participating in the build; running the validation after reactor trimming ensures excluded or non-selected modules do not trigger false-positive warnings.
  3. Refactoring: Renamed the private method to validateExtensionIsNotPartOfReactor and simplified reactor key matching to a clean Set<String> lookup over active projects, backed by integration test coverage in MavenITmng5572ReactorPluginExtensionsTest.

@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.

Clean fix. Moving the extension-in-reactor validation after all reactor trimming steps (trimProjectsToRequest, trimSelectedProjects, trimResumedProjects, trimExcludedProjects) is the right approach — excluded modules should not trigger false-positive warnings.

The Set<String> simplification (replacing the unused Map<String, MavenProject>) and dropping the MavenExecutionRequest parameter + throws clause are good cleanup — the old method only ever called containsKey, never used the MavenProject value, and the exception was only declared because of the now-removed getProjectsInRequestScope call.

IT coverage looks solid: the existing test verifies the warning is still emitted for a full reactor build, and the new test block verifies it's suppressed when the plugin module is excluded via -pl !plugin.

Note: PR #13241 addresses the same issue but retains vestigial complexity (unused MavenExecutionRequest param, Map instead of Set, unnecessary throws clause). This PR is the cleaner of the two.

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

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.

2 participants