Skip to content

[MNG-6979] Initialize the current project from the execution root (backport of #13103 to 4.0.x) - #13143

Merged
gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport/13103-to-4.0.x
Sep 15, 2026
Merged

gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport/13103-to-4.0.x

Conversation

@gnodet

@gnodet gnodet commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Backport of #13103 to the maven-4.0.x branch.

Cherry-pick of 4c3a661, applied cleanly with no conflicts.

â€Ķache#13103)

Use the selected execution root as the initial current project, retaining the first selected project as fallback when the root is absent. This keeps lifecycle participants independent of reactor dependency ordering.

Add regression coverage for lifecycle project selection, empty and filtered reactors, thread-local state, and cloned sessions.
@gnodet gnodet added the bug Something isn't working label Sep 15, 2026

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean backport of #13103 to maven-4.0.x. The reorder in setProjects() is correct: computing topLevelProject first (execution root, or projects.get(0) as fallback) and then using it as the ThreadLocal initial value ensures currentProject and topLevelProject are always in sync, regardless of reactor ordering.

Test coverage is solid: unit tests cover the root-at-any-position case, the fallback-to-first case, ThreadLocal isolation across threads, clone independence, and the setProjects reset semantics. The integration-level testCurrentProjectSelection confirms the full participant lifecycle works end-to-end. Nothing missing.

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

@gnodet gnodet added this to the 4.0.0-rc-7 milestone Sep 15, 2026
@gnodet
gnodet merged commit 7f68413 into apache:maven-4.0.x Sep 15, 2026
22 checks passed
@gnodet
gnodet deleted the backport/13103-to-4.0.x branch October 26, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants