gnodet opened a new issue, #13230:
URL: https://github.com/apache/maven/issues/13230

   ## Problem
   
   In the new phase tree introduced in Maven 4, the `install` and `deploy` 
phases depend on `package` but **not** on `verify`. This means:
   
   1. **The concurrent builder (`-b concurrent`) silently skips `verify`** when 
running `mvn install`, because there is no declared dependency between 
`install` and `verify` in the DAG.
   2. The classic sequential builder still executes `verify` incidentally 
(because phases are flattened in order), but this is an accidental property of 
the flattening, not a semantic guarantee.
   
   This was flagged as a disruptive regression by @rmannibucau: users running 
`mvn install` expect verification (unit tests, integration tests) to have run 
before the artifact is installed to the local repository.
   
   ## Root Cause
   
   In `DefaultLifecycleRegistry.DefaultLifecycle.phases()`, the phase tree is:
   
   ```
   EACH
   ├── VALIDATE / INITIALIZE
   ├── BUILD
   │   ├── SOURCES / RESOURCES
   │   ├── COMPILE (after SOURCES)
   │   ├── READY (after COMPILE, after RESOURCES)
   │   └── PACKAGE (after READY)
   ├── VERIFY                          ← depends on VALIDATE only
   │   ├── UNIT_TEST / TEST / ...
   │   └── INTEGRATION_TEST
   ├── INSTALL  (after PACKAGE)        ← ⚠ should depend on VERIFY
   └── DEPLOY   (after PACKAGE)        ← ⚠ should depend on VERIFY
   ```
   
   `INSTALL` and `DEPLOY` declare `after(PACKAGE)` but not `after(VERIFY)`.
   
   ## Fix
   
   Change `INSTALL` and `DEPLOY` to depend on `VERIFY` instead of `PACKAGE`:
   
   ```java
   phase(INSTALL, after(VERIFY)),
   phase(DEPLOY, after(VERIFY)))));```
   
   This is semantically correct: you should not install an artifact that has 
not been verified. `VERIFY` itself already depends transitively on `PACKAGE` 
(via the `BUILD` subtree), so the full build order is preserved.
   
   ## Planned work
   
   - **4.0.x**: Fix `install` → `verify` and `deploy` → `verify` dependencies 
(this issue)
   - **4.1.0**: Same fix + introduce a `--skip-phases` CLI option as a proper 
replacement for ad-hoc `-DskipTests` conventions (separate issue/PR)
   
   _Reported by 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