{"record":{"id":"49a0b68b2de288d2","repo":"quarkusio/quarkus","slug":"the-parent-project-must-have-a-packaging-type-of-p","errorCode":null,"errorMessage":"The parent project must have a packaging type of POM. Current packaging: ${packaging}","messagePattern":"The parent project must have a packaging type of POM\\. Current packaging: (.+?)","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java","lineNumber":270,"sourceCode":"        Model parentPomModel = null;\n\n        boolean containsAtLeastOneGradleFile = false;\n        for (String gradleFile : Arrays.asList(\"build.gradle\", \"settings.gradle\", \"build.gradle.kts\", \"settings.gradle.kts\")) {\n            containsAtLeastOneGradleFile |= new File(projectRoot, gradleFile).isFile();\n        }\n\n        BuildTool buildToolEnum = BuildTool.findTool(buildTool);\n        if (buildToolEnum == null) {\n            String validBuildTools = String.join(\",\",\n                    Arrays.asList(BuildTool.values()).stream().map(BuildTool::toString).collect(Collectors.toList()));\n            throw new IllegalArgumentException(\"Choose a valid build tool. Accepted values are: \" + validBuildTools);\n        }\n        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        }","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java#L252-L288","documentation":"When creating a Maven project with the quarkus-maven-plugin, if the target directory already contains a pom.xml, the plugin reads it as the prospective parent POM. A parent/aggregate POM must have packaging type `pom`; if the existing pom has a different packaging (jar, war, etc.), the mojo throws this MojoExecutionException because the new project would be added as a module of a non-aggregator POM.","triggerScenarios":"Running `mvn quarkus:create` inside a directory whose pom.xml has packaging jar/war instead of pom, intending to generate the new app as a submodule.","commonSituations":"Developers cd into an application project (packaging jar) instead of the root aggregator directory of a multi-module build, then run the create goal.","solutions":["Run the create goal in the root directory whose pom.xml has `<packaging>pom</packaging>`","If the existing pom should be an aggregator, change its packaging to `<packaging>pom</packaging>`","Create the project in a fresh empty directory instead","Use `-DprojectGroupId/-DprojectArtifactId` with `-DoutputDirectory` pointing at the intended parent dir"],"exampleFix":"// before: existing parent pom.xml\n<packaging>jar</packaging>\n// after\n<packaging>pom</packaging>","handlingStrategy":"validation","validationCode":"File pom = new File(dir, \"pom.xml\");\nif (pom.isFile() && !new String(Files.readAllBytes(pom.toPath())).contains(\"<packaging>pom</packaging>\"))\n    throw new IllegalStateException(\"Parent pom must have packaging 'pom'\");","typeGuard":null,"tryCatchPattern":"try {\n    runCreateGoal();\n} catch (MojoExecutionException e) {\n    if (e.getMessage().startsWith(\"The parent project must have a packaging type of POM\")) {\n        // cd to the aggregator directory or fix the packaging\n    }\n}","preventionTips":["Run create from the multi-module root, not a jar/war module","Ensure aggregate poms declare <packaging>pom</packaging>","Check pwd before invoking the goal in scripts"],"tags":["maven","pom","project-scaffolding"],"backgroundTag":"invalid-packaging-type","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"}