Skip to content

[Backport 4.0.x] Fix filterByScope to expand lifecycle scopes for build ordering - #13070

Merged
gnodet merged 1 commit into
maven-4.0.xfrom
backport/filterByScope-4.0.x
Sep 7, 2026
Merged

[Backport 4.0.x] Fix filterByScope to expand lifecycle scopes for build ordering#13070
gnodet merged 1 commit into
maven-4.0.xfrom
backport/filterByScope-4.0.x

Conversation

@gnodet

@gnodet gnodet commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Backport of #12680 to maven-4.0.x.

Summary

The concurrent builder's filterByScope used exact string matching between the lifecycle dependency scope (e.g. "compile") and the declared artifact scope in the model. This meant a provided-scope reactor dependency was not ordered before the consumer's compile phase, since "compile" != "provided".

Fix

Expand the lifecycle scope to match all artifact scopes that contribute to it for build ordering:

  • "compile" → compile, provided, system (+ null defaults to compile)
  • "runtime" → compile, runtime (+ null)
  • "test" → all scopes
  • "test-only" → test only

Cherry-picked cleanly from master (7f5d22e9ee).

The concurrent builder's filterByScope used exact string matching between
the lifecycle dependency scope (e.g. "compile") and the declared artifact
scope. This meant a provided-scope reactor dependency was not ordered
before the consumer's compile phase, since "compile" != "provided".

Expand the lifecycle scope to match all artifact scopes that contribute
to it:
- "compile" -> compile, provided, system (+ null defaults to compile)
- "runtime" -> compile, runtime (+ null)
- "test"    -> all scopes
- "test-only" -> test only

This ensures provided/system-scope reactor projects are built before
downstream modules that need them for compilation.
@gnodet gnodet added this to the 4.0.0-rc-7 milestone Sep 7, 2026
@gnodet gnodet added bug Something isn't working mvn4 labels Sep 7, 2026
@gnodet
gnodet merged commit 2dfab86 into maven-4.0.x Sep 7, 2026
1 check passed
@gnodet
gnodet deleted the backport/filterByScope-4.0.x branch September 7, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mvn4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant