{"record":{"id":"5f92bfb1a3dbd1ce","repo":"quarkusio/quarkus","slug":"failed-to-collect-compile-only-dependencies-of-a","errorCode":null,"errorMessage":"Failed to collect compile-only dependencies of ${artifact}","messagePattern":"Failed to collect compile-only dependencies of (.+?)","errorType":"exception","errorClass":"BootstrapDependencyProcessingException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyResolver.java","lineNumber":423,"sourceCode":"                    depStack.add(node.getChildren());\n                }\n            }\n            children = depStack.poll();\n        }\n        final CollectRequest request = new CollectRequest()\n                .setDependencies(collectCompileOnly)\n                .setManagedDependencies(new ArrayList<>(managedDeps.values()))\n                .setRepositories(collectRtDepsRequest.getRepositories());\n        if (collectRtDepsRequest.getRoot() != null) {\n            request.setRoot(collectRtDepsRequest.getRoot());\n        } else {\n            request.setRootArtifact(collectRtDepsRequest.getRootArtifact());\n        }\n\n        try {\n            root = resolver.getSystem().collectDependencies(resolver.getSession(), request).getRoot();\n        } catch (DependencyCollectionException e) {\n            throw new BootstrapDependencyProcessingException(\n                    \"Failed to collect compile-only dependencies of \" + root.getArtifact(), e);\n        }\n        children = root.getChildren();\n        int flags = DependencyFlags.DIRECT | DependencyFlags.COMPILE_ONLY;\n        while (children != null) {\n            for (DependencyNode node : children) {\n                if (hasWinner(node)) {\n                    continue;\n                }\n                var extInfo = getExtensionInfoOrNull(node.getArtifact(), node.getRepositories());\n                var dep = appBuilder.getDependency(getKey(node.getArtifact()));\n                if (dep == null) {\n                    dep = newDependencyBuilder(node, resolver).setFlags(flags);\n                    if (extInfo != null) {\n                        dep.setFlags(DependencyFlags.RUNTIME_EXTENSION_ARTIFACT);\n                        if (dep.isFlagSet(DependencyFlags.DIRECT)) {\n                            dep.setFlags(DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT);\n                        }","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyResolver.java#L405-L441","documentation":"collectCompileOnly asks the Maven Resolver to build a dependency graph restricted to compile-only scope. If DependencyCollectionException occurs while collecting the graph, it is wrapped in a BootstrapDependencyProcessingException naming the root artifact whose dependencies could not be collected.","triggerScenarios":"collectCompileOnly (invoked from resolve) calls resolver.getSystem().collectDependencies(...) and catches DependencyCollectionException — e.g. a dependency in the graph cannot be described, a conflicting/invalid POM, or an unresolvable dependency range.","commonSituations":"Cyclic or malformed dependency metadata in a third-party artifact; dependency ranges that resolve to nothing; POMs referencing missing parents somewhere in the compile graph.","solutions":["Inspect the wrapped DependencyCollectionException cause to identify the problematic node in the graph.","Exclude or fix the offending dependency (check for cycles, invalid scopes, missing versions).","Refresh the local cache for the affected artifacts (`mvn -U` or delete from ~/.m2/repository).","Ensure all parents/BOMs referenced in the compile graph are resolvable from configured repositories."],"exampleFix":"// before\n<dependency>\n  <groupId>com.example</groupId><artifactId>bad-lib</artifactId>\n  <version>[2.0,)</version> <!-- range resolves to nothing -->\n</dependency>\n// after\n<dependency>\n  <groupId>com.example</groupId><artifactId>bad-lib</artifactId>\n  <version>2.3.1</version>\n</dependency>","handlingStrategy":"try-catch","validationCode":"// Validate dependency metadata sanity before collection:\nfor (var d : compileDeps) {\n    if (d.getVersion() != null && d.getVersion().startsWith(\"[\")) {\n        throw new IllegalStateException(\"Dependency ranges may fail collection: \" + d);\n    }\n}","typeGuard":"static boolean hasConcreteVersion(org.eclipse.aether.graph.Dependency d) {\n    String v = d.getArtifact().getVersion();\n    return v != null && !v.isEmpty() && !v.startsWith(\"[\") && !v.startsWith(\"(\");\n}","tryCatchPattern":"try {\n    appModel = resolver.resolve(...);\n} catch (BootstrapDependencyProcessingException e) {\n    if (e.getMessage().startsWith(\"Failed to collect compile-only dependencies\")) {\n        log.error(\"Inspect graph: \" + e.getCause().getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Pin concrete versions instead of ranges in the dependency graph.","Avoid dependency cycles between interrelated artifacts.","Ensure parent POMs/BOMs referenced transitively are resolvable."],"tags":["maven","dependency-collection","graph","bootstrap"],"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-12T22:17:10.623Z"}