apache/maven · error · ArtifactResolutionException

Unable to get dependency information for " + artifact.getId(

Error message

Unable to get dependency information for " + artifact.getId() + ": " + e.getMessage()

What it means

While recursing into the dependency graph, DefaultLegacyArtifactCollector asks the ArtifactMetadataSource (retrieve/releaseDependencies) for a child artifact's metadata and POM; an ArtifactMetadataRetrievalException there is wrapped into ArtifactResolutionException('Unable to get dependency information for <artifactId>: <cause>'), with the dependency trail set from the parent node and the child's remote repositories attached. This is the legacy resolver failing to read transitive dependency metadata, not the artifact file itself.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java:533

                            if (rGroup == null) {
                                // relocated dependency artifact is declared excluded, no need to add and recurse
                                // further
                                continue;
                            }

                            child.addDependencies(rGroup.getArtifacts(), rGroup.getResolutionRepositories(), filter);

                        } catch (CyclicDependencyException e) {
                            // would like to throw this, but we have crappy stuff in the repo

                            fireEvent(
                                    ResolutionListener.OMIT_FOR_CYCLE,
                                    listeners,
                                    new ResolutionNode(e.getArtifact(), childRemoteRepositories, child));
                        } catch (ArtifactMetadataRetrievalException e) {
                            artifact.setDependencyTrail(node.getDependencyTrail());

                            throw new ArtifactResolutionException(
                                    "Unable to get dependency information for " + artifact.getId() + ": "
                                            + e.getMessage(),
                                    artifact,
                                    childRemoteRepositories,
                                    e);
                        }

                        ArtifactResolutionRequest subRequest = new ArtifactResolutionRequest(metadataRequest);
                        subRequest.setServers(request.getServers());
                        subRequest.setMirrors(request.getMirrors());
                        subRequest.setProxies(request.getProxies());
                        recurse(
                                result,
                                child,
                                resolvedArtifacts,
                                managedVersions,
                                subRequest,
                                source,

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Inspect the wrapped ArtifactMetadataRetrievalException cause and the artifact id in the message to identify which repository/transfer failed
  2. Fix repository access: settings.xml <server> credentials, mirrorOf rules, proxy config, or remove -o offline mode
  3. Purge suspect cached artifacts with mvn dependency:purge-local-repository -DreResolve=true (or delete the artifact's directory under ~/.m2/repository) then rebuild with -U
  4. If the child artifact is optional for you, exclude it with <exclusions> to unblock the build while the upstream issue is fixed

Example fix

# before
mvn install   # Unable to get dependency information for com.example:lib:jar:1.0

# after: clear corrupt cache and force metadata refresh
rm -rf ~/.m2/repository/com/example/lib
mvn -U install
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check reachability of the repositories used for transitive resolution
for (ArtifactRepository remote : request.getRemoteRepositories()) {
    if (!repoManager.isReachable(remote)) { // HEAD/GET on repo root or metadata URL
        throw new IllegalStateException("Remote repository unreachable before resolve: " + remote.getId());
    }
}

Try / catch

try {
    collector.collect(...);
} catch (ArtifactResolutionException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Unable to get dependency information for")) {
        Artifact failed = e.getArtifact(); // the child whose metadata could not be read
        // decide: retry after fixing access, or exclude the failing dependency
        suggestExclusion(failed);
    }
}

Prevention

When it happens

Trigger: Transitive resolution where retrieval of a child artifact's metadata throws: unreachable repository, missing maven-metadata.xml/POM for the child version, authentication failure, or corrupt cached metadata in the local repository — surfaced through the legacy collector in a build or tool embedding maven-compat.

Common situations: Corporate proxy blocking a repo mid-build; snapshot dependencies whose metadata is inconsistent between mirrored nodes; a repository returning HTML error pages instead of POMs; CI caching a partially-downloaded local repository.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/0b9cb1aa7759ba88. Report an issue: GitHub.