Skip to content

[maven-4.0.x] Fix #12704: Do not report an independent, built module as skipped - #12706

Merged
slachiewicz merged 2 commits into
apache:maven-4.0.xfrom
slachiewicz:concurrent-halt-project-skipped-4.0.x
Aug 8, 2026
Merged

[maven-4.0.x] Fix #12704: Do not report an independent, built module as skipped#12706
slachiewicz merged 2 commits into
apache:maven-4.0.xfrom
slachiewicz:concurrent-halt-project-skipped-4.0.x

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Backport of #12705 to maven-4.0.x. Fixes #12704 on the release branch — the code is identical there, so the bug ships in 4.0.0-rc-4 through rc-6.

The cherry-pick applied without conflicts.

What it fixes

BuildPlanExecutor's TEARDOWN decided between ProjectSucceeded and ProjectSkipped on allStepsExecuted, which required every step of a project's plan to have reached EXECUTED. The plan holds a step for every phase of the lifecycle regardless of the requested tasks, so a project keeps empty steps for the phases beyond them; a halted reactor skips those, and a project that had already finished everything asked of it was reported as skipped. The decision is now based on the steps that carry mojo executions, plus a check that the project's SETUP ran at all.

The accompanying log line always blamed a failed dependency, which is untrue for a project stopped by an unrelated failure. ExecutionEventLogger now tells the two cases apart.

Verification on this branch

  • Repro (two independent modules, one failing, one with 4000 sources still compiling): 3 runs out of 3 — the independent module compiles its 4001 sources, writes its 4000 class files and is reported as succeeded; only the module that genuinely depends on the failed one is skipped, with the dependency wording.
  • MavenITmng8648ProjectEventsTest passes against the patched 4.0.0-SNAPSHOT distribution: subproject-a and subproject-b succeed, subproject-c fails, subproject-d is skipped and keeps the dependency message.
  • Unit tests of impl/maven-core and impl/maven-cli are green (621 tests), spotless:check clean.

Not addressed here

MavenITmng8648ProjectEventsTest stays timing-sensitive: if subproject-c fails before subproject-b's steps are scheduled at all, b is legitimately skipped and the assertion on ProjectSucceeded still fails. That needs an ordering guarantee in the test rather than a change in core.

When the reactor is halted after a module fails, the concurrent builder
turned every project that had not yet run its whole plan into a skipped
one. The plan holds a step for every phase of the lifecycle, so a project
that had already run everything the requested tasks asked of it still had
empty steps left for the phases beyond them; those got skipped along with
the rest, and the project was reported as ProjectSkipped even though it
had built successfully and written its output.

Base the outcome on the steps that carry mojo executions instead: a
project that ran all of its work is reported as succeeded, one that still
had work pending stays skipped, and a project whose setup never ran was
never started and stays skipped as well.

The accompanying log line always blamed a failed dependency, which is the
only reason the legacy builder ever had. A halted project usually has no
failed dependency at all, so tell the two cases apart and say which one
it is.
@slachiewicz slachiewicz added bug Something isn't working mvn4 backport labels Aug 8, 2026

@gnodet gnodet 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 cherry-pick backport of PR #12705 to maven-4.0.x. Both commits are included (the main fix and the follow-up unit tests for hasExecutions()). The code changes are identical to the approved master PR, and all referenced APIs (BuildPlan.step(), BuildStep.skip()/hasExecutions(), ProjectDependencyGraph.getUpstreamProjects()) resolve correctly on the 4.0.x branch.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

@slachiewicz
slachiewicz merged commit bc8eae3 into apache:maven-4.0.x Aug 8, 2026
22 checks passed
@slachiewicz
slachiewicz deleted the concurrent-halt-project-skipped-4.0.x branch August 8, 2026 15:02
@github-actions github-actions Bot added this to the 4.0.0-rc-7 milestone Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working mvn4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants