stevestorey commented on issue #14151:
URL: https://github.com/apache/maven/issues/14151#issuecomment-7237489562

   Thanks for the quick fix. I've retested on `4.0.0-SNAPSHOT` (4.0.x, 
`468bda9`, which includes #14158), and it's only partly fixed. Goals bound to 
`verify` now wait for `package`, but they still don't wait for the phases 
nested inside `verify`, which are `test` and `integration-test`.
   
   Results from the reproducer (`MVN=mvn4 ./check.sh -b concurrent -T1C`, and 
the same with `-T1`):
   
   | Goal | `be1e367` | `468bda9` | Default builder / Maven 3 |
   | --- | --- | --- | --- |
   | `failsafe:verify` | BROKEN | **BROKEN** | OK |
   | `jacoco:check` | BROKEN | **BROKEN** | OK |
   | `dependency:analyze-only` | BROKEN | OK | OK |
   | `gpg:sign` | BROKEN | OK | OK |
   
   `failsafe:verify` now runs after `jar` but before 
`failsafe:integration-test` and `surefire:test`:
   
   ```
   [INFO] --- jar:3.5.1:jar (default-jar) @ verify-repro ---
   [INFO] --- failsafe:3.6.1:verify (default) @ verify-repro ---
   [INFO] No tests to run.
   [INFO] --- failsafe:3.6.1:integration-test (default) @ verify-repro ---
   [INFO] No tests to run.
   [INFO] --- resources:3.5.0:testResources (default-testResources) @ 
verify-repro ---
   [INFO] --- compiler:3.16.0:testCompile (default-testCompile) @ verify-repro 
---
   [INFO] --- surefire:3.6.1:test (default-test) @ verify-repro ---
   [INFO] BUILD SUCCESS
   ```
   
   `jacoco:check` likewise runs straight after `jar`, logs `Skipping JaCoCo 
execution due to missing execution data file`, and passes. `clean install -b 
concurrent` with a failing integration test still installs the jar.
   
   The cause is the second part of the original report. 
`BuildPlanExecutor.calculateLifecycleMappings` places child phases between the 
parent's `before:` and `after:` steps, but it doesn't order the parent's own 
step relative to them:
   
   ```java
   lifecycle.allPhases().forEach(phase -> phase.phases().forEach(child -> {
       steps.get(BEFORE + child.name()).executeAfter(steps.get(BEFORE + 
phase.name()));
       steps.get(AFTER + phase.name()).executeAfter(steps.get(AFTER + 
child.name()));
   }));
   ```
   
   So the `verify` step only depends on `before:verify`, which with #14156 now 
follows `after:build`. Nothing makes it wait for `after:unit-test` or 
`after:integration-test`. The new `testVerifyPhaseWaitsForBuild` test covers 
`before:verify` → `after:build`, but not the `verify` step → its children.
   
   In Maven 3, and in the lifecycle guide, `verify` runs after 
`integration-test` ("run any checks on results of integration tests to ensure 
quality criteria are met"). For that, the parent's step needs to follow its 
children, for example by also adding 
`steps.get(phase.name()).executeAfter(steps.get(AFTER + child.name()))` in the 
loop above. I haven't tested that change or checked what it does to other 
parent phases.
   
   Could this issue be reopened?
   


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