quarkusio/quarkus · error · BootstrapMavenException

Failed to collect dependencies for ${artifact}

Error message

Failed to collect dependencies for ${artifact}

What it means

collectDependencies(Artifact, deps, mainRepos, exclusions) builds and runs an Aether CollectRequest to gather the dependency graph of an artifact. If the dependency graph cannot be collected (a dependency's POM is unresolvable, cycles, missing descriptor), Aether throws DependencyCollectionException wrapped as 'Failed to collect dependencies for <gav>'.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java:249

        return next.toString();
    }

    public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps) throws BootstrapMavenException {
        return collectDependencies(artifact, deps, List.of());
    }

    public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos)
            throws BootstrapMavenException {
        return collectDependencies(artifact, deps, mainRepos, List.of());
    }

    public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos,
            Collection<Exclusion> exclusions) throws BootstrapMavenException {
        try {
            return repoSystem.collectDependencies(repoSession,
                    newCollectRequest(artifact, mainRepos, exclusions).setDependencies(deps));
        } catch (DependencyCollectionException e) {
            throw new BootstrapMavenException("Failed to collect dependencies for " + artifact, e);
        }
    }

    public DependencyResult resolveDependencies(Artifact artifact, List<Dependency> deps) throws BootstrapMavenException {
        return resolveDependencies(artifact, deps, List.of());
    }

    public DependencyResult resolveDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos)
            throws BootstrapMavenException {
        final CollectRequest request = newCollectRequest(artifact, mainRepos);
        request.setDependencies(deps);
        try {
            return repoSystem.resolveDependencies(repoSession,
                    new DependencyRequest().setCollectRequest(request));
        } catch (DependencyResolutionException e) {
            throw new BootstrapMavenException("Failed to resolve dependencies for " + artifact, e);
        }
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the wrapped DependencyCollectionException — getNode()/getResults() show exactly where collection stopped
  2. Make sure repositories hosting the missing transitive POMs are configured (see newCollectRequest/mainRepos)
  3. Fix or override the offending transitive dependency version via dependencyManagement in the app POM
  4. Re-resolve after repairing the local repository for the failing POM

Example fix

// before
collectDependencies(artifact, deps, List.of(), Set.of()); // no repos passed
// after
collectDependencies(artifact, deps, resolver.getRemoteRepositories(), Set.of());
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the root artifact's descriptor resolves before collecting
resolver.resolveDescriptor(artifact); // throws BootstrapMavenException early if unreadable

Try / catch

try {
    CollectResult cr = resolver.collectDependencies(artifact, deps, mainRepos, exclusions);
} catch (BootstrapMavenException e) {
    if (e.getCause() instanceof DependencyCollectionException dce && dce.getResult() != null)
        log.error("Collection stopped at: "
            + (dce.getResult().getRoot() != null ? dce.getResult().getRoot().toString() : "root"));
}

Prevention

When it happens

Trigger: Calling collectDependencies for an artifact whose transitive dependency POMs are missing or invalid; excluded scopes/repositories hide a required parent POM; malformed <dependencyManagement> in the graph.

Common situations: Third-party POMs referencing parents or BOMs that don't exist in the configured repos; corporate mirrors missing an internal artifact; broken dependency version ranges in transitive POMs.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/8d801d8100da39f6. Report an issue: GitHub.