Skip to content

Concurrent builder skips 'verify' phase when running 'mvn install'; missing --skip-tests option #13230

Description

@gnodet

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)))));\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_

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions