quarkusio/quarkus · error · MojoExecutionException

Failed to collect dependencies of ${artifact}

Error message

Failed to collect dependencies of ${artifact}

What it means

This MojoExecutionException wraps any exception thrown while collecting the Maven dependency tree of an artifact in QuarkusProjectStateMojoBase.ensureResolvable. Before processing project state, the mojo ensures the project POM artifact and its dependencies can be resolved; failure to collect that dependency graph aborts with this message. The underlying exception (repository errors, missing artifacts, malformed POMs) is attached as the cause.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/QuarkusProjectStateMojoBase.java:84

    protected abstract void processProjectState(QuarkusProject quarkusProject) throws MojoExecutionException;

    protected ApplicationModel resolveApplicationModel() throws MojoExecutionException {
        try {
            return new BootstrapAppModelResolver(artifactResolver())
                    .resolveModel(ArtifactCoords.pom(project.getGroupId(), project.getArtifactId(), project.getVersion()));
        } catch (AppModelResolverException e) {
            throw new MojoExecutionException("Failed to resolve the Quarkus application model for project "
                    + ArtifactCoords.pom(project.getGroupId(), project.getArtifactId(), project.getVersion()), e);
        }
    }

    private Collection<Path> ensureResolvable(Artifact a) throws MojoExecutionException {
        final DependencyNode root;
        try {
            root = artifactResolver().collectDependencies(a, List.of()).getRoot();
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to collect dependencies of " + a, e);
        }
        final List<Path> createdDirs = new ArrayList<>();
        ensureResolvableModule(root, artifactResolver().getMavenContext().getWorkspace(), createdDirs);
        return createdDirs;
    }

    private void ensureResolvableModule(DependencyNode node, LocalWorkspace workspace, List<Path> createdDirs)
            throws MojoExecutionException {
        Artifact artifact = node.getArtifact();
        if (artifact != null) {
            final LocalProject module = workspace.getProject(artifact.getGroupId(), artifact.getArtifactId());
            if (module != null && !module.getRawModel().getPackaging().equals(ArtifactCoords.TYPE_POM)) {
                final Path classesDir = module.getClassesDir();
                if (!Files.exists(classesDir)) {
                    Path topDirToCreate = classesDir;
                    while (!Files.exists(topDirToCreate.getParent())) {
                        topDirToCreate = topDirToCreate.getParent();
                    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check the cause chain for the specific missing artifact and add/fix it in the pom
  2. Run mvn install -DskipTests to populate the local repository with workspace modules
  3. Verify network/credentials for the remote repositories (settings.xml servers/mirrors)
  4. Use mvn -U to force re-resolution of stale/missing snapshots

Example fix

// before
mvn quarkus:update   (fails collecting deps of com.example:app:1.0-SNAPSHOT)
// after
mvn install -DskipTests && mvn quarkus:update -U
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the dependency tree resolves before invoking the goal:
// mvn dependency:tree -f pom.xml  (fails fast with a clearer error)

Try / catch

try {
    // goal invocation
} catch (MojoExecutionException e) {
    if (e.getMessage().startsWith("Failed to collect dependencies of")) {
        // inspect e.getCause() for the missing artifact, fix pom or repo access
    }
}

Prevention

When it happens

Trigger: Calling ensureResolvable → artifactResolver().collectDependencies(a, List.of()) when the artifact's POM is missing/unresolvable, a dependency version doesn't exist, or repository access fails (auth, network).

Common situations: Project never built locally (siblings not in ~/.m2); invalid dependency version in pom.xml; VPN/private repo unreachable; snapshot artifacts purged from remote.

Related errors


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