{"record":{"id":"d88143f504f18887","repo":"quarkusio/quarkus","slug":"failed-to-locate-project-pom-xml-for-path","errorCode":null,"errorMessage":"Failed to locate project pom.xml for ${path}","messagePattern":"Failed to locate project pom\\.xml for (.+?)","errorType":"exception","errorClass":"BootstrapMavenException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java","lineNumber":168,"sourceCode":"            final Model model = ModelUtils.readModel(pom);\n            model.setPomFile(pom.toFile());\n            return model;\n        } catch (IOException e) {\n            throw new BootstrapMavenException(\"Failed to read \" + pom, e);\n        }\n    }\n\n    static Path locateCurrentProjectPom(Path path, boolean required) throws BootstrapMavenException {\n        Path p = path;\n        while (p != null) {\n            final Path pom = p.resolve(POM_XML);\n            if (Files.exists(pom)) {\n                return pom;\n            }\n            p = p.getParent();\n        }\n        if (required) {\n            throw new BootstrapMavenException(\"Failed to locate project pom.xml for \" + path);\n        }\n        return null;\n    }\n\n    private final Model rawModel;\n    private final Model effectiveModel;\n    private final ModelBuildingResult modelBuildingResult;\n    private final ArtifactKey key;\n    private String version;\n    private final Path dir;\n    private final LocalWorkspace workspace;\n    private volatile LocalProject parent;\n    private volatile WorkspaceModule module;\n\n    /**\n     * TODO: linking LocalProject to a ModelBuildingResult is probably not a good idea.\n     * Perhaps, the result should be cached in the MavenModelBuilder instead.\n     *","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java#L150-L186","documentation":"LocalProject.locateCurrentProjectPom walks up the directory tree from the given path looking for a pom.xml. When `required` is true and no pom.xml is found at or above the path (up to the filesystem root), it throws BootstrapMavenException. This guard exists because the workspace resolver can only operate on an application that is part of a Maven project.","triggerScenarios":"Calling LocalProject.get...()/locateCurrentProjectPom with `required=true` for a path that is not inside any Maven project directory, e.g. an arbitrary temp dir, a directory whose pom.xml was deleted, or a path that is a plain JAR file outside a project tree.","commonSituations":"Running a Quarkus dev-mode/test bootstrap from a directory that is not a Maven project root or module; passing a path to a JAR or a file instead of a project directory; a renamed/moved pom.xml; invoking tooling from the filesystem root or home dir with no pom.xml anywhere above it.","solutions":["Run the bootstrap from a directory that contains a pom.xml (or one of its subdirectories); verify with `ls pom.xml` from the working directory.","If the path may legitimately have no project, use the non-required lookup (or catch BootstrapMavenException) and fall back to resolving the artifact from the repository instead of the workspace.","Restore or recreate the deleted/misplaced pom.xml, or fix the configured project path (e.g. quarkus workspace/project dir or `-f pom.xml` style options)."],"exampleFix":"// before (running from a dir with no pom)\nPath dir = Path.of(\"/tmp/junk\");\nLocalProject project = LocalProject.load(dir); // throws BootstrapMavenException\n// after\nPath dir = Path.of(\"/work/my-app\"); // contains pom.xml\nif (!Files.exists(dir.resolve(\"pom.xml\"))) {\n    throw new IllegalArgumentException(\"Not a Maven project dir: \" + dir);\n}\nLocalProject project = LocalProject.load(dir);","handlingStrategy":"validation","validationCode":"static Path requireProjectPom(Path dir) throws IOException {\n    Path p = dir.toAbsolutePath();\n    while (p != null) {\n        if (Files.exists(p.resolve(\"pom.xml\"))) return p.resolve(\"pom.xml\");\n        p = p.getParent();\n    }\n    throw new IllegalArgumentException(\"No pom.xml found at or above \" + dir);\n}","typeGuard":"static boolean isMavenProjectDir(Path dir) {\n    return dir != null && Files.isDirectory(dir) && Files.exists(dir.resolve(\"pom.xml\"));\n}","tryCatchPattern":"try {\n    LocalProject project = LocalProject.load(dir);\n} catch (BootstrapMavenException e) {\n    // fall back to repository resolution or fail with a clear message\n    log.warn(\"Not a Maven project: \" + dir);\n}","preventionTips":["Always launch dev-mode/tests from the Maven project root or a module directory.","Check `Files.exists(dir.resolve(\"pom.xml\"))` before configuring the bootstrap.","Never point the project path at a JAR or build-output directory."],"tags":["maven","filesystem","quarkus-bootstrap","missing-pom"],"backgroundTag":"missing-pom-xml","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}