quarkusio/quarkus · error · DeploymentInjectionException

Failed to collect dependencies for ${artifact}

Error message

Failed to collect dependencies for ${artifact}

What it means

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.

Source

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

            try (BufferedReader reader = Files.newBufferedReader(visit.getPath())) {
                rtProps.load(reader);
            }
            return rtProps;
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    private DependencyNode collectDependencies(Artifact artifact, Collection<Exclusion> exclusions,
            List<RemoteRepository> repos) {
        final CollectRequest collectRequest = getCollectRequest(artifact, exclusions, repos);
        final DependencyNode root;
        try {
            root = resolver.getSystem()
                    .collectDependencies(resolver.getSession(), collectRequest)
                    .getRoot();
        } catch (DependencyCollectionException e) {
            throw new DeploymentInjectionException("Failed to collect dependencies for " + artifact, e);
        }
        if (root.getChildren().size() != 1) {
            throw new DeploymentInjectionException("Only one child expected but got " + root.getChildren());
        }
        return root.getChildren().get(0);
    }

    private CollectRequest getCollectRequest(Artifact artifact, Collection<Exclusion> exclusions,
            List<RemoteRepository> repos) {
        final ArtifactDescriptorResult descr;
        try {
            descr = resolver.resolveDescriptor(artifact, repos);
        } catch (BootstrapMavenException e) {
            throw new DeploymentInjectionException("Failed to resolve descriptor for " + artifact, e);
        }
        final List<Dependency> effectiveConstraints;
        if (descr.getManagedDependencies().isEmpty()) {
            effectiveConstraints = new ArrayList<>(managedDeps.values());

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run 'mvn dependency:resolve' or 'mvn dependency:get -Dartifact=<group>:<artifact>:<version>' with the same settings to reveal the real underlying artifact/POM failure.
  2. Clear the corrupted artifact directory in ~/.m2/repository for the coordinates in the message and rebuild (mvn -U to force update).
  3. Check quarkus.repositories / settings.xml repositories and proxy configuration; verify network access to the remote repositories.
  4. Verify the extension version exists and is consistent with the Quarkus platform BOM; align versions via the BOM import instead of hardcoding.

Example fix

// before: hardcoded mismatched extension version that no repo can satisfy
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-foo-deployment</artifactId>
  <version>999-SNAPSHOT</version>
</dependency>
// after: import the platform BOM and let versions be managed
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus.platform</groupId>
      <artifactId>quarkus-bom</artifactId>
      <version>3.x.y</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
Defensive patterns

Strategy: try-catch

Validate before calling

// before invoking quarkus:dev/build, verify the artifact resolves
Process p = new ProcessBuilder("mvn", "dependency:get",
    "-Dartifact=" + groupId + ":" + artifactId + ":" + version,
    "-DremoteRepositories=" + repoUrl).inheritIO().start();
if (p.waitFor() != 0) throw new IllegalStateException("artifact not resolvable: " + artifactId);

Try / catch

try {
    quarkusBuild();
} catch (DeploymentInjectionException e) {
    if (e.getMessage().startsWith("Failed to collect dependencies for")) {
        log.error("Check repo access/cache for " + e.getCause(), e);
    }
    throw e;
}

Prevention

When it happens

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

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

Related errors


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