quarkusio/quarkus · error · BootstrapMavenException

Failed to resolve artifact ${artifact}

Error message

Failed to resolve artifact ${artifact}

What it means

The private resolve(Artifact, List<RemoteRepository>) method asks the Maven Resolver (Aether) to resolve a single artifact file. When ArtifactResolutionException is raised (artifact not found in any repository, offline mode, corrupt local cache, etc.), it is wrapped in a BootstrapMavenException with the artifact coordinates.

Source

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

            return List.of();
        }
        var result = new ArrayList<Exclusion>(keys.size());
        for (ArtifactKey key : keys) {
            result.add(new Exclusion(key.getGroupId(), key.getArtifactId(), key.getClassifier(),
                    key.getType() == null || key.getType().isBlank() ? ArtifactCoords.TYPE_JAR : key.getType()));
        }
        return result;
    }

    private ArtifactResult resolve(Artifact artifact, List<RemoteRepository> aggregatedRepos)
            throws BootstrapMavenException {
        try {
            return mvn.getSystem().resolveArtifact(mvn.getSession(),
                    new ArtifactRequest()
                            .setArtifact(artifact)
                            .setRepositories(aggregatedRepos));
        } catch (ArtifactResolutionException e) {
            throw new BootstrapMavenException("Failed to resolve artifact " + artifact, e);
        }
    }

    private ArtifactDescriptorResult resolveDescriptor(Artifact artifact, List<RemoteRepository> aggregatedRepos)
            throws BootstrapMavenException {
        try {
            return mvn.getSystem().readArtifactDescriptor(mvn.getSession(),
                    new ArtifactDescriptorRequest()
                            .setArtifact(artifact)
                            .setRepositories(aggregatedRepos));
        } catch (ArtifactDescriptorException e) {
            throw new BootstrapMavenException("Failed to read descriptor of " + artifact, e);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the wrapped cause for the specific repository/status (404, offline, checksum).
  2. Verify the artifact version exists and is spelled correctly.
  3. Configure the required repository in settings.xml or the project POM; check credentials.
  4. Run `mvn -U` or delete the corrupt ~/.m2/repository entry for the artifact and retry with network access.

Example fix

// before
mvn quarkus:dev -o // offline, artifact not cached
// after
mvn quarkus:dev -U // online, force snapshot/refresh
Defensive patterns

Strategy: try-catch

Validate before calling

try {
    mvn.getSystem().resolveArtifact(mvn.getSession(),
        new ArtifactRequest().setArtifact(artifact).setRepositories(repos));
} catch (ArtifactResolutionException pre) {
    // fail early with a friendly message before invoking the resolver
}

Type guard

static boolean isResolvableLocally(MavenArtifactResolver mvn, org.eclipse.aether.artifact.Artifact a) {
    return mvn.getSession().getLocalRepositoryManager()
        .find(mvn.getSession(), new LocalArtifactRequest()
            .setArtifact(a).setContext("")).getFile() != null;
}

Try / catch

try {
    model = resolver.resolveModel(coords);
} catch (AppModelResolverException | BootstrapMavenException e) {
    if (e.getMessage().startsWith("Failed to resolve artifact")) {
        log.error("Check network/repository settings; artifact: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling resolve (used during app model building) when the Maven resolver cannot download or locate the artifact in the aggregated repositories — network failure, missing repository, wrong version, or corrupt local cache entry.

Common situations: Typo in groupId/artifactId/version; artifact exists only in a corporate repo that is not configured in settings.xml; running offline (-o) with the artifact not cached; 401/403 from an authenticated remote repository.

Related errors


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