Concurrent builder skips 'verify' phase when running 'mvn install'

Open Beginner friendly
#13,230 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
build-system

Research direction

Start in DefaultLifecycleRegistry.DefaultLifecycle.phases() and inspect the phase-tree declarations for INSTALL, DEPLOY, VERIFY, and PACKAGE. Run the relevant Maven build or lifecycle tests with the concurrent builder; done means install and deploy wait for VERIFY while preserving the existing package-to-verify ordering.

Written by the indexing model from the issue text.

Description

bug

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:

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_
Dominant language
Java
Stars
5.4k
Forks
3.1k
Avg merge
20h 29m
Merged PRs (30d)
350

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/maven

All issues in apache/maven

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.