Skip to content
Latchkey

mvn verify: Run Integration Tests (Maven phase)

mvn verify runs the lifecycle through package and then the integration-test and verify phases, where the failsafe plugin executes IT tests and asserts results.

verify is the phase CI uses as the real quality gate: it goes past package to run integration tests, which surefire (unit) does not cover.

What it does

Invoking verify runs everything through package, then pre-integration-test, integration-test, post-integration-test, and verify. The maven-failsafe-plugin binds to integration-test (runs *IT tests) and verify (checks their results and fails the build if any failed), so IT failures are reported at the verify phase.

Common usage

Terminal
mvn verify
mvn clean verify
mvn -B verify -DskipITs          # skip integration tests
mvn verify -Dit.test=PaymentIT

Flags

FlagWhat it does
-DskipITsSkip failsafe integration tests only
-DskipTestsSkip both surefire and failsafe runs
-Dit.test=<Name>Run only matching integration tests
-faeFail at end across modules
-BBatch mode for CI

In CI

Make mvn -B verify the gating job: it covers unit and integration tests in one run. Failsafe deliberately fails at the verify phase rather than integration-test, so post-integration-test cleanup (stopping servers/containers) always runs. Cache ~/.m2.

Common errors in CI

"Failed to execute goal ... maven-failsafe-plugin ... There are test failures" names the failing IT; reports are in target/failsafe-reports. If ITs never run, the failsafe plugin is not configured or your tests do not match the *IT/IT* naming. "BUILD SUCCESS" despite a failed IT usually means failsafe:verify is not bound, so results are never checked.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →