quarkusio/quarkus · error · RuntimeException

Failed to initialize Maven artifact resolver

Error message

Failed to initialize Maven artifact resolver

What it means

RuntimeException from MavenProjectBuildFile.getMavenResolver: the Maven artifact resolver for the devtools project could not be constructed — the bootstrap Maven context failed to initialize (settings problems, no local repo, unreachable configuration). It is a wrapper around the underlying BootstrapMavenException; the input at fault is the project directory / Maven environment of the inspected project.

Source

Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java:153

        if (projectProps.containsKey("maven.compiler.target")) {
            return new JavaVersion(projectProps.getProperty("maven.compiler.target"));
        }
        if (projectProps.containsKey("maven.compiler.source")) {
            return new JavaVersion(projectProps.getProperty("maven.compiler.source"));
        }
        return JavaVersion.NA;
    }

    private static MavenArtifactResolver getMavenResolver(Path projectDir) {
        final RegistriesConfig toolsConfig = QuarkusProjectHelper.toolsConfig();
        try {
            return MavenArtifactResolver.builder()
                    .setArtifactTransferLogging(toolsConfig.isDebug())
                    .setCurrentProject(projectDir.toAbsolutePath().toString())
                    .setPreferPomsFromWorkspace(true)
                    .build();
        } catch (BootstrapMavenException e) {
            throw new RuntimeException("Failed to initialize Maven artifact resolver", e);
        }
    }

    private static String getQuarkusVersion(List<ArtifactCoords> managedDeps) {
        for (ArtifactCoords a : managedDeps) {
            if (a.getArtifactId().endsWith("quarkus-core") && a.getGroupId().equals("io.quarkus")) {
                return a.getVersion();
            }
        }
        return null;
    }

    private static List<ArtifactCoords> toArtifactCoords(List<org.eclipse.aether.graph.Dependency> deps) {
        final List<ArtifactCoords> result = new ArrayList<>(deps.size());
        for (org.eclipse.aether.graph.Dependency dep : deps) {
            org.eclipse.aether.artifact.Artifact a = dep.getArtifact();
            result.add(ArtifactCoords.of(a.getGroupId(), a.getArtifactId(), a.getClassifier(),
                    a.getExtension(), a.getVersion()));

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the caused-by BootstrapMavenException for the root cause (settings, local repo, offline mode)
  2. Verify the target project directory contains a valid pom.xml
  3. Check ~/.m2/settings.xml validity and repository reachability
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java:153 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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