gnodet opened a new pull request, #14214:
URL: https://github.com/apache/maven/pull/14214
Backport of #14193 to `maven-4.0.x`.
## Summary
Add weight-based critical-path scheduling to the concurrent builder (`-b
concurrent`). Each `BuildStep` gets a weight equal to the longest weighted path
from it to any terminal step, computed via a reverse topological pass in
`BuildPlan.computeWeights()`. Weights are pre-sorted after computation —
`executePlan()` no longer re-sorts on every scheduler tick.
By default, graph depth is used as the weight heuristic (each step has
`selfWeight = 1`), which ensures steps on the longest dependency chain are
prioritized first — a significant improvement over the unweighted scan (~19%
median improvement on synthetic benchmark).
Optionally, when `-Dmaven.builder.stepTimings.enabled=true`, step durations
are persisted to `.mvn/target/step-timings.txt` after each build and loaded at
the start of the next build.
## Conflict resolution
**`BuildPlanExecutor.java`** had two conflicts:
1. **`close()`**: Added null-guard on `executor` (already needed on 4.0.x
since the constructor can leave `executor = null`) plus `StepTimings.write()`
and helper methods `isStepTimingsEnabled()` / `rootDirectoryOrNull()`.
2. **`executeStep()`**: Kept the 4.0.x version of SETUP/TEARDOWN (without
master-only APIs `beforeProjectLifecycleExecution`,
`afterProjectExecutionFailure`/`Success` with execution plans), wrapped in
`step.startTime = MonotonicClock.now()` / `try { ... } finally { step.endTime =
MonotonicClock.now(); }`.
**`Constants.java`**: Fixed `@since 4.2.0` → `@since 4.0.0` (this constant
is introduced on `maven-4.0.x` via this backport, not on master first).
Cherry-picked from c8a37669f6b8082b9b848dc45a19579c14093598.
<!-- maven-backport-bot -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]