{"record":{"id":"0fbaf166dc5ba133","repo":"quarkusio/quarkus","slug":"adding-subprojects-to-gradle-projects-is-not-imple","errorCode":null,"errorMessage":"Adding subprojects to gradle projects is not implemented.","messagePattern":"Adding subprojects to gradle projects is not implemented\\.","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java","lineNumber":283,"sourceCode":"        if (BuildTool.MAVEN.equals(buildToolEnum)) {\n            if (pom != null && pom.isFile()) {\n                try {\n                    parentPomModel = MojoUtils.readPom(pom);\n                    if (!\"pom\".equals(parentPomModel.getPackaging())) {\n                        throw new MojoExecutionException(\n                                \"The parent project must have a packaging type of POM. Current packaging: \"\n                                        + parentPomModel.getPackaging());\n                    }\n                } catch (IOException e) {\n                    throw new MojoExecutionException(\"Could not access parent pom.\", e);\n                }\n            } else if (containsAtLeastOneGradleFile) {\n                throw new MojoExecutionException(\n                        \"You are trying to create a Maven project in a directory that contains only Gradle build files.\");\n            }\n        } else if (BuildTool.GRADLE.equals(buildToolEnum) || BuildTool.GRADLE_KOTLIN_DSL.equals(buildToolEnum)) {\n            if (containsAtLeastOneGradleFile) {\n                throw new MojoExecutionException(\"Adding subprojects to gradle projects is not implemented.\");\n            } else if (pom != null && pom.isFile()) {\n                throw new MojoExecutionException(\n                        \"You are trying to create gradle project in a directory that contains only maven build files.\");\n            }\n        }\n\n        askTheUserForMissingValues();\n        if (!DEFAULT_ARTIFACT_ID.equals(projectArtifactId) && !OK_ID.matcher(projectArtifactId).matches()) {\n            throw new MojoExecutionException(String.format(BAD_IDENTIFIER, \"artifactId\", projectArtifactId));\n        }\n        if (!DEFAULT_GROUP_ID.equals(projectGroupId) && !OK_ID.matcher(projectGroupId).matches()) {\n            throw new MojoExecutionException(String.format(BAD_IDENTIFIER, \"groupId\", projectGroupId));\n        }\n\n        projectRoot = new File(outputDirectory, projectArtifactId);\n        if (projectRoot.exists()) {\n            throw new MojoExecutionException(\"Unable to create the project, \" +\n                    \"the directory \" + projectRoot.getAbsolutePath() + \" already exists\");","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java#L265-L301","documentation":"The create goal supports scaffolding Gradle projects only as brand-new roots; adding a new Gradle subproject to an existing Gradle build is not implemented. If the target directory already contains Gradle build files and the selected build tool is gradle (or gradle-kotlin-dsl), the mojo throws this MojoExecutionException instead of attempting a partial subproject generation.","triggerScenarios":"Running `mvn quarkus:create -DbuildTool=gradle` in a directory that already contains build.gradle or settings.gradle files.","commonSituations":"Trying to add a Quarkus service as a module of an existing Gradle multi-project build; CI scripts re-running create in an existing Gradle checkout.","solutions":["Generate the Gradle project in a fresh empty directory, then integrate it as a subproject manually (add `include` to settings.gradle, set its parent)","Hand-write the Gradle subproject build file against the Quarkus Gradle plugin documentation","Use code.quarkus.io to generate the project separately and copy it in"],"exampleFix":"// before: settings.gradle of parent, expecting plugin to edit it\n// (plugin refuses; must be done manually)\ninclude 'app'\n// after: generate in empty dir, then add manually in parent settings.gradle\ninclude 'my-quarkus-app'","handlingStrategy":"validation","validationCode":"boolean hasGradleFiles = Stream.of(\"build.gradle\",\"settings.gradle\",\"build.gradle.kts\",\"settings.gradle.kts\")\n        .anyMatch(n -> new File(dir, n).isFile());\nif (buildTool.startsWith(\"gradle\") && hasGradleFiles)\n    throw new IllegalStateException(\"Subproject generation not supported; use an empty directory\");","typeGuard":null,"tryCatchPattern":"try {\n    runCreateGoal();\n} catch (MojoExecutionException e) {\n    if (e.getMessage().contains(\"Adding subprojects to gradle projects is not implemented\")) {\n        // generate separately and wire into settings.gradle manually\n    }\n}","preventionTips":["Only generate Gradle projects into empty directories","Plan Quarkus subprojects by manual settings.gradle integration","Document this limitation in team build scripts"],"tags":["gradle","unsupported-feature","project-scaffolding"],"backgroundTag":"feature-not-implemented","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}