{"record":{"id":"a730df9e30e097c3","repo":"quarkusio/quarkus","slug":"failed-to-collect-dependencies-for-artifact","errorCode":null,"errorMessage":"Failed to collect dependencies for ${artifact}","messagePattern":"Failed to collect dependencies for (.+?)","errorType":"exception","errorClass":"DeploymentInjectionException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyResolver.java","lineNumber":911,"sourceCode":"            try (BufferedReader reader = Files.newBufferedReader(visit.getPath())) {\n                rtProps.load(reader);\n            }\n            return rtProps;\n        } catch (IOException e) {\n            throw new UncheckedIOException(e);\n        }\n    }\n\n    private DependencyNode collectDependencies(Artifact artifact, Collection<Exclusion> exclusions,\n            List<RemoteRepository> repos) {\n        final CollectRequest collectRequest = getCollectRequest(artifact, exclusions, repos);\n        final DependencyNode root;\n        try {\n            root = resolver.getSystem()\n                    .collectDependencies(resolver.getSession(), collectRequest)\n                    .getRoot();\n        } catch (DependencyCollectionException e) {\n            throw new DeploymentInjectionException(\"Failed to collect dependencies for \" + artifact, e);\n        }\n        if (root.getChildren().size() != 1) {\n            throw new DeploymentInjectionException(\"Only one child expected but got \" + root.getChildren());\n        }\n        return root.getChildren().get(0);\n    }\n\n    private CollectRequest getCollectRequest(Artifact artifact, Collection<Exclusion> exclusions,\n            List<RemoteRepository> repos) {\n        final ArtifactDescriptorResult descr;\n        try {\n            descr = resolver.resolveDescriptor(artifact, repos);\n        } catch (BootstrapMavenException e) {\n            throw new DeploymentInjectionException(\"Failed to resolve descriptor for \" + artifact, e);\n        }\n        final List<Dependency> effectiveConstraints;\n        if (descr.getManagedDependencies().isEmpty()) {\n            effectiveConstraints = new ArrayList<>(managedDeps.values());","sourceCodeStart":893,"sourceCodeEnd":929,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyResolver.java#L893-L929","documentation":"ApplicationDependencyResolver wraps Maven Resolver's DependencyCollectionException when it fails to build the dependency graph for an extension artifact being injected during Quarkus deployment. It is thrown from collectDependencies(), which runs a CollectRequest (with managed constraints merged from the platform BOM and the artifact's own descriptor) through RepositorySystem.collectDependencies(). If Maven cannot read a POM, resolve versions, or walk the graph, this error surfaces with the offending artifact in the message.","triggerScenarios":"Any call to ApplicationDependencyResolver.collectDependencies (used when injecting a deployment artifact's dependencies, e.g. collectDeploymentDeps() resolving info.deploymentArtifact) where Resolver's collectDependencies throws DependencyCollectionException — typically a missing/unreadable POM for the artifact or one of its transitive dependencies, or an unresolvable version range.","commonSituations":"The deployment artifact (e.g. io.quarkus:quarkus-foo-deployment) is not available in any configured repository; a corrupted local Maven cache (~/.m2/repository entry with a .lastUpdated marker); a transitive POM refers to a missing parent; offline mode with never-downloaded artifacts; a corporate proxy blocking repo access; version ranges that cannot be satisfied.","solutions":["Run 'mvn dependency:resolve' or 'mvn dependency:get -Dartifact=<group>:<artifact>:<version>' with the same settings to reveal the real underlying artifact/POM failure.","Clear the corrupted artifact directory in ~/.m2/repository for the coordinates in the message and rebuild (mvn -U to force update).","Check quarkus.repositories / settings.xml repositories and proxy configuration; verify network access to the remote repositories.","Verify the extension version exists and is consistent with the Quarkus platform BOM; align versions via the BOM import instead of hardcoding."],"exampleFix":"// before: hardcoded mismatched extension version that no repo can satisfy\n<dependency>\n  <groupId>io.quarkus</groupId>\n  <artifactId>quarkus-foo-deployment</artifactId>\n  <version>999-SNAPSHOT</version>\n</dependency>\n// after: import the platform BOM and let versions be managed\n<dependencyManagement>\n  <dependencies>\n    <dependency>\n      <groupId>io.quarkus.platform</groupId>\n      <artifactId>quarkus-bom</artifactId>\n      <version>3.x.y</version>\n      <type>pom</type>\n      <scope>import</scope>\n    </dependency>\n  </dependencies>\n</dependencyManagement>","handlingStrategy":"try-catch","validationCode":"// before invoking quarkus:dev/build, verify the artifact resolves\nProcess p = new ProcessBuilder(\"mvn\", \"dependency:get\",\n    \"-Dartifact=\" + groupId + \":\" + artifactId + \":\" + version,\n    \"-DremoteRepositories=\" + repoUrl).inheritIO().start();\nif (p.waitFor() != 0) throw new IllegalStateException(\"artifact not resolvable: \" + artifactId);","typeGuard":null,"tryCatchPattern":"try {\n    quarkusBuild();\n} catch (DeploymentInjectionException e) {\n    if (e.getMessage().startsWith(\"Failed to collect dependencies for\")) {\n        log.error(\"Check repo access/cache for \" + e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["Import the Quarkus platform BOM instead of hardcoding extension versions.","Run builds with mvn -U after version changes to refresh stale metadata.","Ensure all remote repositories (and proxies) in settings.xml are reachable from CI.","Periodically clean ~/.m2/repository entries that fail with .lastUpdated markers."],"tags":["maven","dependency-resolution","quarkus-deployment"],"backgroundTag":"maven-dependency-resolution-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"}