mvn install: Usage, Options & Common CI Errors
Publish the artifact to your local ~/.m2 repo for downstream modules.
install is the Maven lifecycle phase that installs the packaged artifact into the local repository (~/.m2/repository) so that other projects on the same machine can depend on it. It runs the full lifecycle through verify first.
What it does
install copies the artifact plus its POM into the local repository under groupId/artifactId/version. In a multi-module reactor build, this is how downstream modules resolve sibling modules. It does not push to a remote repository (that is deploy).
Common usage
mvn install
mvn install -DskipTests
mvn clean install -pl module-a -am # install module-a and what it depends on
mvn install -Dmaven.repo.local=.m2/repository # CI-cacheable repo pathCommon error in CI (and the fix)
Symptom: a reactor build fails with "Could not find artifact com.example:module-a:jar:1.0 in ..." even though module-a is in the same repo. Cause: building one module without its dependencies installed. Fix: build the whole reactor (mvn install from the root), or use -pl module-b -am so Maven also builds the modules module-b depends on (-am = also-make).