quarkusio/quarkus · error · BootstrapDependencyProcessingException

Failed to collect compile-only dependencies of

Error message

Failed to collect compile-only dependencies of 

What it means

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.

Source

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

                    depStack.add(node.getChildren());
                }
            }
            children = depStack.poll();
        }
        final CollectRequest request = new CollectRequest()
                .setDependencies(collectCompileOnly)
                .setManagedDependencies(new ArrayList<>(managedDeps.values()))
                .setRepositories(collectRtDepsRequest.getRepositories());
        if (collectRtDepsRequest.getRoot() != null) {
            request.setRoot(collectRtDepsRequest.getRoot());
        } else {
            request.setRootArtifact(collectRtDepsRequest.getRootArtifact());
        }

        try {
            root = resolver.getSystem().collectDependencies(resolver.getSession(), request).getRoot();
        } catch (DependencyCollectionException e) {
            throw new BootstrapDependencyProcessingException(
                    "Failed to collect compile-only dependencies of " + root.getArtifact(), e);
        }
        children = root.getChildren();
        int flags = DependencyFlags.DIRECT | DependencyFlags.COMPILE_ONLY;
        while (children != null) {
            for (DependencyNode node : children) {
                var extInfo = getExtensionInfoOrNull(node.getArtifact(), node.getRepositories());
                var dep = appBuilder.getDependency(getKey(node.getArtifact()));
                if (dep == null) {
                    dep = newDependencyBuilder(node, resolver).setFlags(flags);
                    if (extInfo != null) {
                        dep.setFlags(DependencyFlags.RUNTIME_EXTENSION_ARTIFACT);
                        if (dep.isFlagSet(DependencyFlags.DIRECT)) {
                            dep.setFlags(DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT);
                        }
                    }
                    appBuilder.addDependency(dep);
                } else {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify each compile-only dependency coordinate resolves: 'mvn dependency:get -Dartifact=g:a:v'.
  2. Check the message's cause chain (DependencyCollectionException) for the exact failing artifact/POM and fix or add the missing repository.
  3. Ensure a version is manageable: provide an explicit version or add the artifact to a BOM/dependencyManagement so the imposed constraints resolve.
  4. Clear the artifact from ~/.m2/repository and re-run with -U.

Example fix

// before: compile-only dep with no version and no management
quarkus.bootstrap.compile-only-deps=com.acme:acme-lib
// after: pin a version so collection can succeed
quarkus.bootstrap.compile-only-deps=com.acme:acme-lib:2.3.1
Defensive patterns

Strategy: validation

Validate before calling

// every compile-only dependency must have a resolvable coordinate before the build
for (String dep : compileOnlyDeps) { // e.g. "g:a:v"
    String[] parts = dep.split(":");
    if (parts.length < 3)
        throw new IllegalArgumentException("compile-only dep needs explicit version: " + dep);
}

Try / catch

try {
    quarkusBuild();
} catch (BootstrapDependencyProcessingException e) {
    if (e.getMessage().startsWith("Failed to collect compile-only dependencies")) {
        log.error("Fix compile-only dep coordinates/repo access; cause: " + e.getCause(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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