Error Knowledge Base MAVEN DEPENDENCY_RESOLUTION_FAILURE

Could not resolve dependencies for project

Maven cannot download or resolve one or more dependencies required by the project.

Affected versions: All supported Apache Maven versions.

What This Error Means

Maven cannot download or resolve one or more dependencies required by the project.

How to Fix It

  1. Identify the first missing/failed artifact in the output (look for Could not find artifact ... or Could not transfer artifact ...).
  2. Confirm the dependency coordinates in pom.xml are correct (exact groupId/artifactId/version, and snapshot vs release).
  3. Confirm the artifact exists in the intended repository (Maven Central or your internal repository manager) with the exact coordinates.
  4. 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>).
  5. If the error mentions cached misses or you recently published the artifact, force updates once: mvn -U -DskipTests package.
  6. Clear the specific cached failure: delete the affected artifact directory and any *.lastUpdated files under ~/.m2/repository/<groupId path>/<artifactId>/, then retry.
  7. If this only fails on certain networks, fix proxy/TLS access first (check settings.xml proxies and corporate certificate trust), then retry.
  8. 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 found or transfer failure was cached in .m2 (*.lastUpdated), so Maven is not retrying yet.

How to Verify

  1. Re-run mvn -DskipTests package and confirm dependency resolution completes without errors.
  2. Run mvn -q -DskipTests dependency:tree and confirm the previously failing artifact resolves.

Manual dependency resolution checklist

  1. Run with stack traces to find the first Caused by line: mvn -e -DskipTests package.
  2. Print effective settings (mirrors, proxies, servers): mvn -q help:effective-settings.
  3. Force Maven to re-check remote repos once: mvn -U -DskipTests package.
  4. Inspect the dependency chain that pulled in the failing artifact: mvn -q -DskipTests dependency:tree.
  5. Try fetching the failing artifact directly (replace coordinates): mvn -q -Dartifact=groupId:artifactId:version dependency:get.
  6. 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

  1. Maven reads your pom.xml, builds a dependency graph, and computes the full transitive set of artifacts.
  2. Artifacts (POMs, JARs, metadata) are downloaded from configured repositories (and mirrors) into the local repository (default: ~/.m2/repository).
  3. 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;

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list