{"record":{"id":"3b47ee2700563fd3","repo":"quarkusio/quarkus","slug":"unable-to-determine-project-root","errorCode":null,"errorMessage":"Unable to determine project root","messagePattern":"Unable to determine project root","errorType":"console","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/container-image/container-image-docker-common/deployment/src/main/java/io/quarkus/container/image/docker/common/deployment/CommonProcessor.java","lineNumber":425,"sourceCode":"            if (mainSourcesRoot == null) {\n                return null;\n            }\n\n            var dockerfilesRoot = mainSourcesRoot.getKey().resolve(DOCKER_DIRECTORY_NAME);\n            if (!dockerfilesRoot.toFile().exists()) {\n                return null;\n            }\n\n            return new AbstractMap.SimpleEntry<>(dockerfilesRoot, mainSourcesRoot.getValue());\n        }\n    }\n\n    protected record ProvidedDockerfile(Path dockerfilePath, Path dockerExecutionPath) implements DockerfilePaths {\n        protected static DockerfilePaths get(Path dockerfilePath, Path outputDirectory) {\n            var mainSourcesRoot = findMainSourcesRoot(outputDirectory);\n\n            if (mainSourcesRoot == null) {\n                throw new IllegalStateException(\"Unable to determine project root\");\n            }\n\n            var executionPath = mainSourcesRoot.getValue();\n            var effectiveDockerfilePath = dockerfilePath.isAbsolute() ? dockerfilePath : executionPath.resolve(dockerfilePath);\n\n            if (!effectiveDockerfilePath.toFile().exists()) {\n                throw new IllegalArgumentException(\n                        \"Specified Dockerfile path %s does not exist\".formatted(effectiveDockerfilePath.toAbsolutePath()));\n            }\n\n            return new ProvidedDockerfile(effectiveDockerfilePath, executionPath);\n        }\n    }\n}\n","sourceCodeStart":407,"sourceCodeEnd":440,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/container-image/container-image-docker-common/deployment/src/main/java/io/quarkus/container/image/docker/common/deployment/CommonProcessor.java#L407-L440","documentation":"When a custom Dockerfile path is configured (quarkus.container-image.docker.dockerfile-jvm-path or -native-path), ProvidedDockerfile.get() first resolves the project's main sources root from the build output directory. If that root cannot be determined, it throws this IllegalStateException because relative Dockerfile paths cannot be resolved.","triggerScenarios":"Building a container image with a custom dockerfile-jvm-path/dockerfile-native-path set while the output directory layout does not allow deriving the sources root (e.g. unusual project structure, relocated target/ directory, non-standard build setups).","commonSituations":"Highly customized Maven/Gradle builds that move the classes output far from the project root; invoking the image build from a stripped/copied project tree; monorepo setups where outputDirectory sits in an unexpected place.","solutions":["Restore the standard Maven/Gradle directory layout so the sources root can be derived from the output directory","Use an absolute path for the configured Dockerfile so resolution does not depend on the sources root","Verify the build output directory (target/ or build/) is in its default location relative to the project root","Run the build from the project root rather than from an external directory"],"exampleFix":"# before (relative path, odd layout)\nquarkus.container-image.docker.dockerfile-jvm-path=docker/Dockerfile.jvm\n# after (absolute path)\nquarkus.container-image.docker.dockerfile-jvm-path=/opt/ci/docker/Dockerfile.jvm","handlingStrategy":"fallback","validationCode":"Path output = Path.of(\"target/classes\");\nPath projectRoot = output.getParent() == null ? null : output.getParent().getParent();\nif (projectRoot == null || !Files.isDirectory(projectRoot.resolve(\"src/main\"))) {\n    System.err.println(\"WARN: project root not derivable; use an absolute dockerfile path\");\n}","typeGuard":"boolean sourcesRootDerivable(Path outputDirectory) {\n    Path p = outputDirectory;\n    for (int i = 0; i < 3 && p != null; i++) {\n        if (Files.isDirectory(p.resolve(\"src/main\"))) return true;\n        p = p.getParent();\n    }\n    return false;\n}","tryCatchPattern":"try {\n    buildImage();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Unable to determine project root\")) {\n        throw new IllegalStateException(\"Use an absolute quarkus.container-image.docker.dockerfile-*-path or standard layout\", e);\n    }\n    throw e;\n}","preventionTips":["Keep the standard Maven/Gradle output layout (target/classes, build/classes)","Prefer absolute Dockerfile paths in heavily customized builds","Run image builds from the project root","Avoid relocating target/ via non-standard build configurations"],"tags":["docker","dockerfile","project-layout","configuration"],"backgroundTag":"dockerfile-not-found","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"}