quarkusio/quarkus · error · MojoExecutionException
Failed to initialize Maven artifact resolver
Error message
Failed to initialize Maven artifact resolver
What it means
CreateProjectMojo (quarkus-maven-plugin create goal) builds a MavenArtifactResolver from the current Maven session's repository system, session, remote repositories, and repository manager. If any of these components is missing, misconfigured, or the resolver builder fails for any reason, the mojo wraps the exception in a MojoExecutionException with this message. It indicates the plugin could not set up local/remote artifact resolution, so project generation cannot proceed.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java:242
// version may not be supported.
mavenVersionEnforcer.ensureMavenVersion(getLog(), session);
try {
Files.createDirectories(outputDirectory.toPath());
} catch (IOException e) {
throw new MojoExecutionException("Could not create directory " + outputDirectory, e);
}
final MavenArtifactResolver mvn;
try {
mvn = MavenArtifactResolver.builder()
.setRepositorySystem(repoSystem)
.setRepositorySystemSession(
getLog().isDebugEnabled() ? repoSession : MojoUtils.muteTransferListener(repoSession))
.setRemoteRepositories(repos)
.setRemoteRepositoryManager(remoteRepoManager)
.build();
} catch (Exception e) {
throw new MojoExecutionException("Failed to initialize Maven artifact resolver", e);
}
final MojoMessageWriter log = new MojoMessageWriter(getLog());
ExtensionCatalogResolver catalogResolver = getExtensionCatalogResolver(mvn, log);
ExtensionCatalog catalog = resolveExtensionsCatalog(this, bomGroupId, bomArtifactId, bomVersion, stream,
catalogResolver, mvn, log);
File projectRoot = outputDirectory;
File pom = project != null ? project.getFile() : null;
Model parentPomModel = null;
boolean containsAtLeastOneGradleFile = false;
for (String gradleFile : Arrays.asList("build.gradle", "settings.gradle", "build.gradle.kts", "settings.gradle.kts")) {
containsAtLeastOneGradleFile |= new File(projectRoot, gradleFile).isFile();
}
BuildTool buildToolEnum = BuildTool.findTool(buildTool);
if (buildToolEnum == null) {View on GitHub (pinned to e1c734241f)
Solutions
- Run `mvn -X` (debug) to see the underlying cause wrapped in this exception
- Check ~/.m2/settings.xml for invalid mirrors, proxies, or localRepository paths
- Verify Maven version meets Quarkus requirements (mvn -version)
- Update the quarkus-maven-plugin to the latest patch release
- Run with a clean local repo backup (e.g. mv ~/.m2/repository temporarily aside) to rule out repository corruption
Example fix
// before: custom settings.xml with a broken mirror <mirror><id>internal</id><url>http://bad-host/repo</url><mirrorOf>*</mirrorOf></mirror> // after: valid mirror or removed mirror block <mirror><id>central</id><url>https://repo.maven.apache.org/maven2</url><mirrorOf>central</mirrorOf></mirror>
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check Maven env before invoking the create goal mvn -version && test -w ~/.m2 && mvn help:effective-settings -q
Try / catch
try {
invokeCreateGoal();
} catch (MojoExecutionException e) {
if (e.getMessage().contains("Failed to initialize Maven artifact resolver")) {
logCause(e.getCause()); // inspect wrapped resolver error, fix settings.xml/repo config
}
} Prevention
- Keep Maven updated to a Quarkus-supported version
- Validate ~/.m2/settings.xml with `mvn help:effective-settings`
- Avoid broken mirrors/proxies in settings.xml
- Run with -X once to learn the wrapped cause
When it happens
Trigger: Running `mvn io.quarkus:quarkus-maven-plugin:create` where the RepositorySystem/RepositorySystemSession is not injectable or configured, remote repositories (`repos`) are empty or malformed, or Maven artifact resolver internals throw during builder().build().
Common situations: Broken or very old Maven installations, corrupted local repository settings, custom settings.xml with invalid mirror/repository definitions, or plugin running in a stripped-down Maven environment where resolver components are unavailable.
Related errors
- Failed to initialize Maven artifact resolver
- Failed to initialize Maven artifact resolver
- The parent project must have a packaging type of POM. Curren
- Failed to initialize Maven artifact resolver
- Unable to determine groupId and artifactId of the jar that c
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f0a2869996f10a89.
Report an issue: GitHub.