{"record":{"id":"8d801d8100da39f6","repo":"quarkusio/quarkus","slug":"failed-to-collect-dependencies-for-artifact-8d801d","errorCode":null,"errorMessage":"Failed to collect dependencies for ${artifact}","messagePattern":"Failed to collect dependencies for (.+?)","errorType":"exception","errorClass":"BootstrapMavenException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java","lineNumber":249,"sourceCode":"        return next.toString();\n    }\n\n    public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps) throws BootstrapMavenException {\n        return collectDependencies(artifact, deps, List.of());\n    }\n\n    public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos)\n            throws BootstrapMavenException {\n        return collectDependencies(artifact, deps, mainRepos, List.of());\n    }\n\n    public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos,\n            Collection<Exclusion> exclusions) throws BootstrapMavenException {\n        try {\n            return repoSystem.collectDependencies(repoSession,\n                    newCollectRequest(artifact, mainRepos, exclusions).setDependencies(deps));\n        } catch (DependencyCollectionException e) {\n            throw new BootstrapMavenException(\"Failed to collect dependencies for \" + artifact, e);\n        }\n    }\n\n    public DependencyResult resolveDependencies(Artifact artifact, List<Dependency> deps) throws BootstrapMavenException {\n        return resolveDependencies(artifact, deps, List.of());\n    }\n\n    public DependencyResult resolveDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos)\n            throws BootstrapMavenException {\n        final CollectRequest request = newCollectRequest(artifact, mainRepos);\n        request.setDependencies(deps);\n        try {\n            return repoSystem.resolveDependencies(repoSession,\n                    new DependencyRequest().setCollectRequest(request));\n        } catch (DependencyResolutionException e) {\n            throw new BootstrapMavenException(\"Failed to resolve dependencies for \" + artifact, e);\n        }\n    }","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java#L231-L267","documentation":"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>'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped DependencyCollectionException — getNode()/getResults() show exactly where collection stopped","Make sure repositories hosting the missing transitive POMs are configured (see newCollectRequest/mainRepos)","Fix or override the offending transitive dependency version via dependencyManagement in the app POM","Re-resolve after repairing the local repository for the failing POM"],"exampleFix":"// before\ncollectDependencies(artifact, deps, List.of(), Set.of()); // no repos passed\n// after\ncollectDependencies(artifact, deps, resolver.getRemoteRepositories(), Set.of());","handlingStrategy":"try-catch","validationCode":"// ensure the root artifact's descriptor resolves before collecting\nresolver.resolveDescriptor(artifact); // throws BootstrapMavenException early if unreadable","typeGuard":null,"tryCatchPattern":"try {\n    CollectResult cr = resolver.collectDependencies(artifact, deps, mainRepos, exclusions);\n} catch (BootstrapMavenException e) {\n    if (e.getCause() instanceof DependencyCollectionException dce && dce.getResult() != null)\n        log.error(\"Collection stopped at: \"\n            + (dce.getResult().getRoot() != null ? dce.getResult().getRoot().toString() : \"root\"));\n}","preventionTips":["Configure all repositories hosting transitive parents/BOMs before collection","Keep exclusions minimal — over-exclusion hides needed POMs","Run with verbose Maven logging to see which POM fetch failed","Cache a known-good dependency graph and diff when upgrades break collection"],"tags":["maven","dependency-tree","resolution"],"backgroundTag":"dependency-collection-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}