mvn verify: Usage, Options & Common CI Errors
The phase CI should run - package plus integration tests and checks.
verify is the Maven lifecycle phase that runs any checks to confirm the package is valid and meets quality criteria. It runs after package and is where the maven-failsafe-plugin executes integration tests, making it the recommended CI build goal.
What it does
verify runs the full lifecycle through package, then executes integration-test and verify goals. Failsafe runs *IT/IT*/*ITCase classes during integration-test and asserts their results during verify, so a failed integration test fails the build at the verify step (not mid-package).
Common usage
mvn verify
mvn clean verify
mvn verify -DskipITs # skip integration tests only (Failsafe)
mvn verify -Pintegration # activate an integration-test profileCommon error in CI (and the fix)
Symptom: unit tests pass under mvn test but integration tests "never run" in CI. Cause: Failsafe is not configured or its integration-test and verify goals are not bound, so IT classes are skipped. Fix: add the maven-failsafe-plugin with executions for the integration-test and verify goals, name IT classes *IT, and run mvn verify (not mvn test) in the pipeline.