What This Error Means
Maven cannot download or resolve one or more dependencies required by the project.
How to Fix It
- Identify the first missing/failed artifact in the output (look for
Could not find artifact ...orCould not transfer artifact ...). - Confirm the dependency coordinates in
pom.xmlare correct (exact groupId/artifactId/version, and snapshot vs release). - Confirm the artifact exists in the intended repository (Maven Central or your internal repository manager) with the exact coordinates.
- If the artifact is private, ensure the correct repository is configured and credentials are provided via
~/.m2/settings.xml(match<server><id>...</id></server>to the repository<id>). - If the error mentions cached misses or you recently published the artifact, force updates once:
mvn -U -DskipTests package. - Clear the specific cached failure: delete the affected artifact directory and any
*.lastUpdatedfiles under~/.m2/repository/<groupId path>/<artifactId>/, then retry. - If this only fails on certain networks, fix proxy/TLS access first (check
settings.xmlproxies and corporate certificate trust), then retry. - If needed, re-run with debug to see the exact repository URLs Maven is using:
mvn -X -DskipTests package.
Why It Happens
- The dependency coordinates are wrong (
groupId/artifactId/version/ classifier / packaging). - The artifact exists, but it is in a repository Maven is not configured to use (missing repository, mirror, or profile).
- A corporate proxy/VPN/firewall blocks Maven from reaching the repository host.
- The repository requires authentication, but no matching
<server>credentials are configured in~/.m2/settings.xml. - A previous
not foundor transfer failure was cached in.m2(*.lastUpdated), so Maven is not retrying yet.
How to Verify
- Re-run
mvn -DskipTests packageand confirm dependency resolution completes without errors. - Run
mvn -q -DskipTests dependency:treeand confirm the previously failing artifact resolves.
Manual dependency resolution checklist
- Run with stack traces to find the first
Caused byline:mvn -e -DskipTests package. - Print effective settings (mirrors, proxies, servers):
mvn -q help:effective-settings. - Force Maven to re-check remote repos once:
mvn -U -DskipTests package. - Inspect the dependency chain that pulled in the failing artifact:
mvn -q -DskipTests dependency:tree. - Try fetching the failing artifact directly (replace coordinates):
mvn -q -Dartifact=groupId:artifactId:version dependency:get. - Print the local repository path Maven is using:
mvn -q help:evaluate -Dexpression=settings.localRepository -DforceStdout.
Common CLI Output
[ERROR] Failed to execute goal on project app: Could not resolve dependencies for project com.example:app:jar:1.0.0: Failed to collect dependencies at org.example:lib:jar:1.2.3: Failed to read artifact descriptor for org.example:lib:jar:1.2.3[ERROR] Could not resolve dependencies for project com.example:app:jar:1.0.0: The following artifacts could not be resolved: org.example:lib:jar:1.2.3: Could not find artifact org.example:lib:jar:1.2.3 in central (https://repo.maven.apache.org/maven2) How Maven resolves dependencies
- Maven reads your
pom.xml, builds a dependency graph, and computes the full transitive set of artifacts. - Artifacts (POMs, JARs, metadata) are downloaded from configured repositories (and mirrors) into the local repository (default:
~/.m2/repository). - If any artifact is missing, blocked, unauthorized, or fails to download, the dependency resolution phase fails and the build stops.
Prevention Tips
- Use a repository manager (RepoFlow/Nexus/Artifactory) as a single upstream proxy for Maven Central and private repositories.
- Publish artifacts (including parent POMs) before consuming them in CI.
- Pin dependency versions to keep builds repeatable across environments.
- Standardize
settings.xml(mirrors/proxies/servers) for developer machines and CI runners.
Where This Can Be Triggered
github.com/apache/maven/blob/maven-3.9.6/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
Maven constructs the top-level "Could not resolve dependencies for project ..." message while rethrowing dependency resolution failures. - GitHub
String msg = "Could not resolve dependencies for project " + project.getId() + ": " + e.getMessage();
DependencyResolutionException dex = new DependencyResolutionException(msg, e);
dex.setResult(e.getResult());
throw dex;