quarkusio/quarkus · critical · RuntimeException

Failed to initialize Maven artifact resolver

Error message

Failed to initialize Maven artifact resolver

What it means

createArtifactResolver builds a MavenArtifactResolver on top of a freshly created Maven context; if either the resolver construction or the underlying createMavenContext call throws BootstrapMavenException, it is wrapped in RuntimeException('Failed to initialize Maven artifact resolver'). This blocks any goal that needs to resolve artifacts (adding extensions, creating projects, resolving platform BOMs).

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/components/QuarkusWorkspaceProvider.java:117

                                    .setSupplier(new BeanSupplier<ModelBuilder>() {
                                        @Override
                                        public ModelBuilder get(Scope scope) {
                                            return new MavenModelBuilder(ctx);
                                        }
                                    }).setPriority(100).build(),
                            DependencyFilter.ACCEPT);
                }
            };
        } catch (BootstrapMavenException e) {
            throw new RuntimeException("Failed to initialize Quarkus Maven context", e);
        }
    }

    public MavenArtifactResolver createArtifactResolver(BootstrapMavenContextConfig<?> config) {
        try {
            return new MavenArtifactResolver(createMavenContext(config));
        } catch (BootstrapMavenException e) {
            throw new RuntimeException("Failed to initialize Maven artifact resolver", e);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check network/proxy/mirror settings and confirm the remote repositories in settings.xml are reachable (curl the repo URL).
  2. Ensure the local repository (~/.m2/repository or -Dmaven.repo.local) exists, is writable, and is not corrupt; clear the failing artifact's directory and retry.
  3. Verify any custom BootstrapMavenContextConfig values (project root, local repo path, remote repos) point to real, valid locations.
  4. Run `mvn validate` / `mvn -U` to confirm Maven itself can resolve your project, then retry the Quarkus goal; inspect with mvn -e to see the wrapped cause.

Example fix

// before: unreachable mirror blocks artifact resolution
<mirror><id>corp</id><mirrorOf>*</mirrorOf><url>http://dead.internal/repo</url></mirror>
// after: mirror removed or pointed at a reachable repository
<mirror><id>central</id><mirrorOf>central</mirrorOf><url>https://repo.maven.apache.org/maven2</url></mirror>
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: confirm Maven can resolve the project and reach remotes
Process mvn = new ProcessBuilder("mvn", "-q", "-U", "dependency:resolve-plugins")
        .directory(projectDir)
        .inheritIO()
        .start();
if (mvn.waitFor() != 0) {
    throw new IllegalStateException("Artifact resolution broken; check repos/proxy/local repo");
}

Try / catch

try {
    MavenArtifactResolver resolver = workspaceProvider.createArtifactResolver(config);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("Failed to initialize Maven artifact resolver")) {
        throw new IllegalStateException("Resolver bootstrap failed: " + e.getCause(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling createArtifactResolver(BootstrapMavenContextConfig) when new MavenArtifactResolver(createMavenContext(config)) fails: the Maven context bootstrap fails (see error 518) or the resolver itself cannot be built from the context — bad local repository, unresolvable remote repositories, or invalid config values in the BootstrapMavenContextConfig.

Common situations: Same causes as the Maven-context failure plus resolver-specific ones: unwritable/corrupt local repo, proxy blocking remote repo access, a custom BootstrapMavenContextConfig pointing at a nonexistent pom.xml or wrong remote repositories; commonly seen when Quarkus platform BOMs cannot be resolved at project creation.

Related errors


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