mvn dependency:resolve: Usage & Common CI Errors
Download and list every dependency - great for pre-warming the CI cache.
dependency:resolve is a maven-dependency-plugin goal that resolves and lists all of a project’s dependencies, downloading any that are missing from the local repository. It is commonly used to populate the ~/.m2 cache early in a pipeline.
What it does
dependency:resolve resolves the compile/runtime/test dependencies and downloads their artifacts into ~/.m2. The related dependency:go-offline goal additionally fetches the plugins needed to build offline, which is what you want before an -o build.
Common usage
mvn dependency:resolve
mvn dependency:resolve -Dclassifier=sources # also fetch sources jars
mvn dependency:go-offline # deps + plugins for offline build
mvn -o package # then build offlineCommon error in CI (and the fix)
Symptom: a later -o (offline) build fails with "Cannot access ... in offline mode" even though dependency:resolve ran. Cause: resolve fetches dependencies but not all build plugins, so offline mode still misses a plugin. Fix: use mvn dependency:go-offline (which also pulls plugins) to warm the cache before switching to offline, and cache the whole ~/.m2/repository between CI runs.