Maven "mvn: command not found" in CI - Install or PATH Maven
The shell could not find the mvn binary. Either Maven is not installed on the runner, or it is installed but its bin directory is not on PATH.
What this error means
The build step fails instantly with mvn: command not found (or mvn: not found) before any Maven output. Nothing about the POM is reached.
shell
+ mvn -B clean verify
/usr/bin/env: bash: line 1: mvn: command not found
##[error]Process completed with exit code 127.Common causes
Maven not installed on the runner
A minimal base image or container ships a JDK but not Maven. The mvn launcher simply does not exist.
Maven installed but not on PATH
Maven is unpacked somewhere under /opt, but its bin directory was never added to PATH, so the shell cannot resolve mvn.
How to fix it
Use the Maven Wrapper so no global install is needed
Commit the wrapper and call ./mvnw; it downloads the pinned Maven version on demand.
Terminal
mvn -N wrapper:wrapper -Dmaven=3.9.9 # generate mvnw once, commit it
./mvnw -B clean verify # CI uses the wrapperInstall Maven on the runner
Install the package or unpack the distribution and put its bin on PATH.
Terminal
# Debian/Ubuntu
apt-get update && apt-get install -y maven
mvn -versionHow to prevent it
- Prefer the committed Maven Wrapper (
./mvnw) so every runner uses the same pinned Maven without a global install or PATH tweak.
Related guides
Maven "No goals have been specified" / Lifecycle Errors in CIFix Maven "No goals have been specified for this build" and unknown-lifecycle-phase errors in CI - calling mv…
CI "java: command not found" / No JDK on PATH - Fix SetupFix "java: command not found" / "javac: command not found" in CI - no JDK installed or not on PATH because se…
Gradle Version Incompatible With Java Version - Fix in CIFix Gradle failing because the Gradle version does not support the JDK running it (too new or too old) - upgr…