{"record":{"id":"bd045d123b91f6e2","repo":"quarkusio/quarkus","slug":"failed-to-initialize-maven-artifact-resolver-bd045d","errorCode":null,"errorMessage":"Failed to initialize Maven artifact resolver","messagePattern":"Failed to initialize Maven artifact resolver","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java","lineNumber":1418,"sourceCode":"    private interface NodeHandler {\n        void handle(Log log, int depth, Node n, List<ArtifactKey> collected);\n    }\n\n    private MavenArtifactResolver resolver() throws MojoExecutionException {\n        if (resolver == null) {\n            final DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(repoSession);\n            session.setWorkspaceReader(workspaceProvider.workspace());\n            try {\n                final BootstrapMavenContext ctx = new BootstrapMavenContext(BootstrapMavenContext.config()\n                        .setRepositorySystem(repoSystem)\n                        .setRemoteRepositoryManager(remoteRepoManager)\n                        .setRepositorySystemSession(session)\n                        .setRemoteRepositories(repos)\n                        .setPreferPomsFromWorkspace(true)\n                        .setCurrentProject(workspaceProvider.origin()));\n                resolver = new MavenArtifactResolver(ctx);\n            } catch (BootstrapMavenException e) {\n                throw new MojoExecutionException(\"Failed to initialize Maven artifact resolver\", e);\n            }\n        }\n        return resolver;\n    }\n\n    private File resolve(org.eclipse.aether.artifact.Artifact a) throws MojoExecutionException {\n        try {\n            return resolver().resolve(a).getArtifact().getFile();\n        } catch (MojoExecutionException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new MojoExecutionException(\"Failed to resolve \" + a, e);\n        }\n    }\n}\n","sourceCodeStart":1400,"sourceCodeEnd":1434,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java#L1400-L1434","documentation":"ExtensionDescriptorMojo lazily creates a MavenArtifactResolver to resolve artifacts from the Maven repository system. Initialization delegates to BootstrapMavenContext; if the Maven environment cannot be bootstrapped (bad settings.xml, invalid repo config, corrupt local repo), a BootstrapMavenException is thrown and wrapped in this MojoExecutionException.","triggerScenarios":"Running the extension-descriptor Maven goal when MavenArtifactResolver's constructor throws BootstrapMavenException, e.g. because the Maven session, repositories, or workspace origin cannot be bootstrapped.","commonSituations":"Malformed ~/.m2/settings.xml, unreachable repository manager, invalid mirror/profile configuration, corrupted local repository metadata, or a mismatched Maven version when building a Quarkus extension.","solutions":["Run `mvn -X` to inspect the underlying BootstrapMavenException cause and fix settings.xml/repository configuration","Validate ~/.m2/settings.xml (mirrors, profiles, localRepository path) and test repository connectivity","Clear the corrupt local repository entry (`mvn dependency:purge-local-repository` or delete the offending artifact dir) and rebuild","Verify the Maven/JDK version matches Quarkus build requirements"],"exampleFix":"// before: broken settings.xml pointing at dead mirror\n<mirror><url>https://dead-nexus.example.com/...</url></mirror>\n// after: correct or remove the mirror entry in ~/.m2/settings.xml\n<mirror><url>https://repo.maven.apache.org/maven2</url></mirror>","handlingStrategy":"try-catch","validationCode":"// check Maven env before the build\nFile settings = new File(System.getProperty(\"user.home\"), \".m2/settings.xml\");\nif (settings.exists() && !new SettingsReader().parses(settings)) {\n    throw new IllegalStateException(\"Invalid ~/.m2/settings.xml\");\n}","typeGuard":null,"tryCatchPattern":"try { resolver = new MavenArtifactResolver(ctx); } catch (BootstrapMavenException e) { throw new MojoExecutionException(\"Failed to initialize Maven artifact resolver\", e); } // always log/report e.getCause()","preventionTips":["Keep ~/.m2/settings.xml valid and minimal","Test repository connectivity before release builds","Pin supported Maven/JDK versions in CI","Avoid corrupting the local repo; use dependency:purge-local-repository on suspicion"],"tags":["maven","build-tool","configuration"],"backgroundTag":"maven-resolver-init-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}