gnodet opened a new pull request, #14156:
URL: https://github.com/apache/maven/pull/14156

   ## Summary
   
   Fix the concurrent builder (`-b concurrent`) executing goals bound to the 
`verify`
   phase (e.g. `failsafe:verify`, `jacoco:check`, `dependency:analyze-only`, 
`gpg:sign`)
   before compilation, tests and packaging have completed.
   
   ## Root Cause
   
   In the Maven 4 lifecycle hierarchy, `BUILD` and `VERIFY` are sibling phases 
under
   `EACH`. `VERIFY` only declared `after(VALIDATE)`, so its `before:verify` 
build step
   had no ordering edge to `after:build` in the execution DAG. The concurrent 
builder
   could therefore schedule any mojo bound to `verify` immediately after 
validation,
   before `compile`, `test`, or `package` ran.
   
   `INTEGRATION_TEST` (a child of `VERIFY`) correctly declared `after(BUILD)`, 
but that
   constraint only protected mojos bound to `integration-test`, not to `verify` 
itself.
   
   Maven 3 and the Maven 4 default builder are unaffected because they execute 
phases
   strictly in sequence.
   
   ## Fix
   
   Add `after(BUILD)` to the `VERIFY` phase definition in 
`DefaultLifecycleRegistry`:
   
   ```java
   // Before
   phase(VERIFY, after(VALIDATE), ...)
   
   // After
   phase(VERIFY, after(VALIDATE), after(BUILD), ...)
   ```
   
   This inserts the edge `before:verify → after:build` into the DAG, ensuring 
that any
   mojo bound to `verify` or any of its child phases (that doesn't already 
declare its
   own `after(BUILD)` constraint) waits for the full `BUILD` phase — including 
`package`
   — to complete. This matches Maven 3 sequential semantics.
   
   ## Tests
   
   Added `BuildPlanCreatorTest#testVerifyPhaseWaitsForBuild` which asserts that
   `before:verify` transitively depends on `after:build` and `after:package` in 
the
   build plan DAG.
   
   The test was verified RED on the unfixed code and GREEN with the fix applied.
   
   Fixes #14151
   
   ---
   _Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet_
   


-- 
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]

Reply via email to