Problem
In the new phase tree introduced in Maven 4, the install and deploy phases depend on package but not on verify. This means:
- 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.
- 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:
phase(INSTALL, after(VERIFY)),
phase(DEPLOY, after(VERIFY)))));\n```
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 → #13231
- **4.1.0**: Same DAG fix → #13232
_Reported by Guillaume Nodet_
Problem
In the new phase tree introduced in Maven 4, the
installanddeployphases depend onpackagebut not onverify. This means:-b concurrent) silently skipsverifywhen runningmvn install, because there is no declared dependency betweeninstallandverifyin the DAG.verifyincidentally (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 installexpect 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:INSTALLandDEPLOYdeclareafter(PACKAGE)but notafter(VERIFY).Fix
Change
INSTALLandDEPLOYto depend onVERIFYinstead ofPACKAGE: