{"record":{"id":"a3b3c8374f448b6d","repo":"quarkusio/quarkus","slug":"failed-to-initialize-quarkus-maven-context","errorCode":null,"errorMessage":"Failed to initialize Quarkus Maven context","messagePattern":"Failed to initialize Quarkus Maven context","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"devtools/maven/src/main/java/io/quarkus/maven/components/QuarkusWorkspaceProvider.java","lineNumber":109,"sourceCode":"                            builder -> builder.addBeanInstance(versionResolver)\n                                    .addBeanInstance(versionRangeResolver)\n                                    .addBeanInstance(artifactResolver)\n                                    .addBeanInstance(metadataResolver)\n                                    .addBeanInstance(deployer)\n                                    .addBeanInstance(remoteRepoManager)\n                                    .addBeanInstance(settingsDecrypter)\n                                    .addBean(ModelBuilder.class)\n                                    .setSupplier(new BeanSupplier<ModelBuilder>() {\n                                        @Override\n                                        public ModelBuilder get(Scope scope) {\n                                            return new MavenModelBuilder(ctx);\n                                        }\n                                    }).setPriority(100).build(),\n                            DependencyFilter.ACCEPT);\n                }\n            };\n        } catch (BootstrapMavenException e) {\n            throw new RuntimeException(\"Failed to initialize Quarkus Maven context\", e);\n        }\n    }\n\n    public MavenArtifactResolver createArtifactResolver(BootstrapMavenContextConfig<?> config) {\n        try {\n            return new MavenArtifactResolver(createMavenContext(config));\n        } catch (BootstrapMavenException e) {\n            throw new RuntimeException(\"Failed to initialize Maven artifact resolver\", e);\n        }\n    }\n}\n","sourceCodeStart":91,"sourceCodeEnd":121,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/components/QuarkusWorkspaceProvider.java#L91-L121","documentation":"createMavenContext builds a QuarkusMavenContext (workspace model, remote repositories, etc.); any BootstrapMavenException during that process is wrapped in RuntimeException('Failed to initialize Quarkus Maven context'). It means Quarkus tooling could not construct its view of the Maven project/workspace — usually bad settings, an unresolvable parent POM, or an invalid project model. It is called by getMavenContext and createArtifactResolver, so it surfaces whenever Quarkus Maven plugin goals start up.","triggerScenarios":"Calling createMavenContext(config) (directly or via getMavenContext()/createArtifactResolver) when the bootstrap fails: invalid or unreachable settings.xml, unresolvable parent POM or BOM in the reactor, corrupt local repository metadata, or an invalid BootstrapMavenContextConfig (bad paths, wrong root project).","commonSituations":"Project with a missing or unbuildable parent POM; network/proxy preventing resolution of the parent/BOM during workspace bootstrap; settings.xml with a broken localRepository or profiles; running quarkus:add-extension / quarkus:dev in a directory that is not a valid Maven project root.","solutions":["Run `mvn validate` first — fix any reported POM problems (missing parent, invalid XML, wrong coordinates).","Check ~/.m2/settings.xml validity and connectivity to repositories (proxy/mirror config); retry after network is restored.","Verify you are running the goal from a valid Maven project directory containing a buildable pom.xml.","Run with mvn -e -X to see the wrapped BootstrapMavenException cause and address it specifically (e.g. delete corrupt ~/.m2/repository metadata for the failing artifact)."],"exampleFix":"// before: running tooling in a directory without a resolvable parent\n<parent><groupId>com.acme</groupId><artifactId>parent</artifactId><version>1.0</version></parent> // not in any repo\n// after: install the parent first or fix its coordinates\ncd ../parent && mvn install -N && cd ../app && mvn quarkus:add-extension -Dextensions=\"rest\"","handlingStrategy":"validation","validationCode":"// validate the project model before bootstrapping Quarkus tooling\nProcess mvn = new ProcessBuilder(\"mvn\", \"-q\", \"validate\")\n        .directory(projectDir)\n        .inheritIO()\n        .start();\nif (mvn.waitFor() != 0) {\n    throw new IllegalStateException(\"Project model invalid; fix pom.xml/parent before running Quarkus goals\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    MavenArtifactResolver r = workspaceProvider.createArtifactResolver(cfg);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Failed to initialize Quarkus Maven context\")) {\n        throw new IllegalStateException(\"Maven context bootstrap failed: \" + e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["Run `mvn validate` as a preflight before Quarkus Maven goals","Make sure parent POMs/BOMs are installed locally (mvn install -N) or resolvable from remote repos","Check proxy/mirror configuration when behind a corporate firewall","Run goals from a directory with a valid, complete pom.xml"],"tags":["maven","bootstrap","workspace","project-model"],"backgroundTag":"maven-bootstrap-failure","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"}