{"record":{"id":"1ce3463f16b6ba9d","repo":"quarkusio/quarkus","slug":"failed-to-collect-compile-only-dependencies-of","errorCode":null,"errorMessage":"Failed to collect compile-only dependencies of ","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/ApplicationDependencyTreeResolver.java","lineNumber":309,"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                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                        }\n                    }\n                    appBuilder.addDependency(dep);\n                } else {","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyTreeResolver.java#L291-L327","documentation":"collectCompileOnly() re-collects a dependency graph for compile-only dependencies (dependencies declared with quarkus dependency overrides that should only be on the compile classpath), enforcing the already-resolved build-time dependencies as managed version constraints. If RepositorySystem.collectDependencies throws DependencyCollectionException for this secondary request, it is wrapped in this BootstrapDependencyProcessingException naming the root artifact.","triggerScenarios":"collectCompileOnly(collectRtDepsRequest, root) is invoked (only when compile-only dependencies are present, i.e. quarkus.bootstrap.dep... compile-only configuration in use) and Maven fails to collect the graph — typically a compile-only artifact's POM is missing/unreadable, or its version conflicts irreconcilably with the constraints imposed from the runtime graph.","commonSituations":"A compile-only dependency coordinate that doesn't exist in any repository; version ranges or missing versions with no constraint covering them; conflicts where the managed constraint forces an unbuildable combination; corrupt local cache for the compile-only artifact.","solutions":["Verify each compile-only dependency coordinate resolves: 'mvn dependency:get -Dartifact=g:a:v'.","Check the message's cause chain (DependencyCollectionException) for the exact failing artifact/POM and fix or add the missing repository.","Ensure a version is manageable: provide an explicit version or add the artifact to a BOM/dependencyManagement so the imposed constraints resolve.","Clear the artifact from ~/.m2/repository and re-run with -U."],"exampleFix":"// before: compile-only dep with no version and no management\nquarkus.bootstrap.compile-only-deps=com.acme:acme-lib\n// after: pin a version so collection can succeed\nquarkus.bootstrap.compile-only-deps=com.acme:acme-lib:2.3.1","handlingStrategy":"validation","validationCode":"// every compile-only dependency must have a resolvable coordinate before the build\nfor (String dep : compileOnlyDeps) { // e.g. \"g:a:v\"\n    String[] parts = dep.split(\":\");\n    if (parts.length < 3)\n        throw new IllegalArgumentException(\"compile-only dep needs explicit version: \" + dep);\n}","typeGuard":null,"tryCatchPattern":"try {\n    quarkusBuild();\n} catch (BootstrapDependencyProcessingException e) {\n    if (e.getMessage().startsWith(\"Failed to collect compile-only dependencies\")) {\n        log.error(\"Fix compile-only dep coordinates/repo access; cause: \" + e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["Always pin explicit versions for compile-only dependencies (or cover them via a BOM).","Verify each compile-only coordinate with mvn dependency:get before wiring it in.","Keep compile-only versions compatible with the managed runtime versions to avoid constraint conflicts.","Refresh local cache with -U if the artifact was previously half-downloaded."],"tags":["maven","dependency-resolution","compile-only"],"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"}