{"record":{"id":"46357d6f7308b1f7","repo":"quarkusio/quarkus","slug":"failed-to-locate-project-dir-for","errorCode":null,"errorMessage":"Failed to locate project dir for ","messagePattern":"Failed to locate project dir for ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java","lineNumber":39,"sourceCode":"import io.quarkus.bootstrap.workspace.WorkspaceModule;\nimport io.quarkus.maven.dependency.ResolvedDependency;\n\n/**\n * IDE entry point.\n * <p>\n * This is launched from the core/launcher module. To avoid any shading issues core/launcher unpacks all its dependencies\n * into the jar file, then uses a custom class loader load them.\n */\npublic class IDELauncherImpl implements Closeable {\n\n    public static final String FORCE_COLOR_SUPPORT = \"io.quarkus.force-color-support\";\n\n    public static Closeable launch(Path classesDir, Map<String, Object> context) {\n        System.setProperty(FORCE_COLOR_SUPPORT, \"true\");\n        System.setProperty(\"quarkus.console.basic\", \"true\"); //IDE's don't support raw mode\n        final Path projectDir = BuildToolHelper.getProjectDir(classesDir);\n        if (projectDir == null) {\n            throw new IllegalStateException(\"Failed to locate project dir for \" + classesDir);\n        }\n        try {\n            //todo : proper support for everything\n            final QuarkusBootstrap.Builder builder = QuarkusBootstrap.builder()\n                    .setBaseClassLoader(IDELauncherImpl.class.getClassLoader())\n                    .setIsolateDeployment(true)\n                    .setMode(QuarkusBootstrap.Mode.DEV)\n                    .setTargetDirectory(classesDir.getParent());\n            if (BuildToolHelper.isGradleProject(classesDir)) {\n                final ApplicationModel quarkusModel = BuildToolHelper.enableGradleAppModelForDevMode(classesDir);\n                context.put(BootstrapConstants.SERIALIZED_APP_MODEL,\n                        ApplicationModelSerializer.serializeGradleModel(quarkusModel, false));\n\n                ArtifactSources mainSources = quarkusModel.getApplicationModule().getMainSources();\n\n                PathsCollection applicationRoots = collectOutputDirs(mainSources);\n                final Path launchingModulePath = applicationRoots.iterator().next();\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java#L21-L57","documentation":"IDELauncherImpl.launch throws this IllegalStateException when BuildToolHelper.getProjectDir(classesDir) returns null, meaning no project root (pom.xml/gradle files) could be located above the given classes directory. Without a project dir the IDE dev-mode launcher cannot construct a QuarkusBootstrap.","triggerScenarios":"Calling IDELauncherImpl.launch(classesDir, context) with a classes directory that is not under a Maven or Gradle project root — the traversal up the directory tree finds no build-tool marker file.","commonSituations":"IDE run configurations pointing at a copied classes directory (e.g. under /tmp), launching after moving the project, or running compiled classes outside their source project entirely.","solutions":["Run the app from a classes directory inside the actual Maven/Gradle project","Ensure pom.xml or Gradle build files exist at the project root (they are the markers searched for)","Fix the IDE run configuration's working directory/output path","Rebuild the project in place rather than copying class output elsewhere"],"exampleFix":"// before\nIDELauncherImpl.launch(Path.of(\"/tmp/classes\"), context);\n// after\nIDELauncherImpl.launch(Path.of(\"/home/dev/myapp/target/classes\"), context); // project root discoverable upward","handlingStrategy":"validation","validationCode":"Path classes = Path.of(\"/home/dev/myapp/target/classes\");\nboolean hasProjectRoot = false;\nfor (Path p = classes; p != null; p = p.getParent()) {\n    if (Files.exists(p.resolve(\"pom.xml\")) || Files.exists(p.resolve(\"build.gradle\"))) { hasProjectRoot = true; break; }\n}\nif (!hasProjectRoot) throw new IllegalStateException(\"No project dir above \" + classes);","typeGuard":null,"tryCatchPattern":"try {\n    IDELauncherImpl.launch(classesDir, ctx);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Failed to locate project dir\")) { /* fix classesDir */ }\n}","preventionTips":["Launch from the project's target/classes, not a copied location","Keep pom.xml/gradle files at the project root intact","Fix IDE run-configuration working directories"],"tags":["ide","project-root","bootstrap"],"backgroundTag":"maven-project-not-found","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"}