mvn -o (offline mode): Usage & Common CI Errors
Build with zero network - only what is already in ~/.m2.
The -o (or --offline) flag tells Maven to operate offline, resolving everything from the local repository and never contacting remote repositories. It makes builds hermetic and fast but fails if anything is missing from the cache.
What it does
In offline mode Maven skips all remote repository access for dependencies and plugins. Builds become reproducible and immune to registry outages, at the cost of requiring a fully populated ~/.m2 beforehand.
Common usage
mvn dependency:go-offline # populate cache (deps + plugins) first
mvn -o package # then build offline
mvn --offline verifyCommon error in CI (and the fix)
Symptom: "Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact ... has not been downloaded from it before." Cause: a required dependency or plugin is not in the local cache. Fix: run mvn dependency:go-offline (and build once online) to fully warm ~/.m2, cache that directory between runs, then switch the build step to -o.