Maven Failsafe "There are test failures" (integration) in CI
maven-failsafe-plugin ran the integration tests (*IT) during integration-test and the verify phase reported failures. Unlike Surefire, Failsafe lets the build continue post-integration so resources get torn down, then fails at verify.
What this error means
mvn verify ends with "Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:...:verify ... There are test failures." and a summary of failing *IT classes.
[INFO] Results:
[ERROR] Failures:
[ERROR] OrderFlowIT.placesOrder:88 expected:<200> but was:<500>
[ERROR] Tests run: 12, Failures: 1, Errors: 0, Skipped: 0
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-failsafe-plugin:3.2.5:verify (default) on project app:
There are test failures. -> [Help 1]Common causes
A real integration test failure
An *IT test asserted something the application or its dependencies did not satisfy in the CI environment.
Missing services or environment in CI
Integration tests need a database, container, or network resource that is present locally but not provisioned in the runner.
How to fix it
Read the failsafe reports
- Open
target/failsafe-reports/*.txtfor the failing*IT. - Fix the code or provision the missing dependency (DB, service container).
- Re-run
mvn verifyto confirm green.
mvn -B verify
cat target/failsafe-reports/*.txtProvision integration dependencies in CI
Start the services the IT suite needs as job services so the runner matches local conditions.
services:
postgres:
image: postgres:16
env: { POSTGRES_PASSWORD: test }
ports: ['5432:5432']How to prevent it
- Provision required services for integration tests in CI.
- Keep IT suites hermetic and deterministic.
- Publish failsafe reports as artifacts for triage.