quarkusio/quarkus · error · DeploymentInjectionException

Failed to resolve artifact

Error message

Failed to resolve artifact 

What it means

Thrown when the Maven Resolver cannot download/locate the JAR file of an artifact whose file was not already available locally. In ApplicationDependencyResolver.resolve(), if artifact.getFile() is null, an ArtifactRequest is sent to RepositorySystem.resolveArtifact(); an ArtifactResolutionException (artifact not found in local cache or remote repos) is wrapped in this DeploymentInjectionException naming the artifact.

Source

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

                .setManagedDependencies(effectiveConstraints)
                .setRepositories(repos)
                // formal root artifact
                .setRootArtifact(new DefaultArtifact("io.quarkus", "quarkus-root-artifact", ArtifactCoords.TYPE_JAR, "1.0"))
                .setDependencies(List.of(new Dependency(artifact, JavaScopes.COMPILE, false, exclusions)));
    }

    private Artifact resolve(Artifact artifact, List<RemoteRepository> repos) {
        if (artifact.getFile() != null) {
            return artifact;
        }
        try {
            return resolver.getSystem().resolveArtifact(resolver.getSession(),
                    new ArtifactRequest()
                            .setArtifact(artifact)
                            .setRepositories(repos))
                    .getArtifact();
        } catch (ArtifactResolutionException e) {
            throw new DeploymentInjectionException("Failed to resolve artifact " + artifact, e);
        }
    }

    private class ExtensionDependency {

        static ExtensionDependency get(DependencyNode node) {
            return (ExtensionDependency) node.getData().get(QUARKUS_EXTENSION_DEPENDENCY);
        }

        final ExtensionInfo info;
        final DependencyNode runtimeNode;
        final Collection<Exclusion> exclusions;
        boolean conditionalDepsQueued;
        private List<ExtensionDependency> extDeps;
        private DependencyNode deploymentNode;
        private boolean presentInTargetGraph;

        ExtensionDependency(ExtensionInfo info, DependencyNode node, Collection<Exclusion> exclusions) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check the local repo path ~/.m2/repository/<g>/<a>/<v>/ for the JAR; delete *.lastUpdated files and retry with mvn -U.
  2. Confirm the artifact JAR (not just POM) is published in one of the configured repositories — curl the repository URL for the artifact path.
  3. Fix mirror/exclusion configuration in settings.xml that may be routing requests away from the hosting repository.
  4. Run without -o (offline) so remote resolution can happen.

Example fix

// before: offline flag prevents JAR download
$ mvn quarkus:dev -o
// after: allow remote resolution and force snapshot refresh
$ mvn quarkus:dev -U
Defensive patterns

Strategy: retry

Validate before calling

Path jar = Path.of(System.getProperty("user.home"), ".m2", "repository",
    g.replace('.', '/'), a, v, a + "-" + v + ".jar");
boolean locallyAvailable = Files.exists(jar);
// if !locallyAvailable, ensure network/repo access before invoking the build

Try / catch

try {
    build();
} catch (DeploymentInjectionException e) {
    if (e.getMessage().contains("Failed to resolve artifact")) {
        // one offline/network retry after cache cleanup
        cleanLastUpdatedMarkers();
        buildWithFlags("-U");
    } else throw e;
}

Prevention

When it happens

Trigger: resolve(artifact, repos) is called for an artifact (e.g. a deployment JAR fetched during dependency injection) whose JAR file is absent from the local repository and cannot be fetched from the configured remote repositories.

Common situations: POM resolved (descriptor was cached) but the JAR was never downloaded and the machine is offline; repository mirrored/relocated so the JAR URL 404s; missing classifier handling; corporate mirror excluding the repository that holds the artifact; snapshot JAR purged from remote.

Related errors


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