quarkusio/quarkus · error · MojoExecutionException

${BAD_IDENTIFIER formatted with 'groupId' and projectGroupId

Error message

${BAD_IDENTIFIER formatted with 'groupId' and projectGroupId}

What it means

Same validation as the artifactId check but applied to the project groupId: after user input, the mojo validates projectGroupId against the OK_ID regex and throws a MojoExecutionException via the BAD_IDENTIFIER template when it does not match a valid Java package-style identifier. GroupIds must be reverse-domain style package names (letters, digits, dots, hyphens/underscores in segments).

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java:295

            } else if (containsAtLeastOneGradleFile) {
                throw new MojoExecutionException(
                        "You are trying to create a Maven project in a directory that contains only Gradle build files.");
            }
        } else if (BuildTool.GRADLE.equals(buildToolEnum) || BuildTool.GRADLE_KOTLIN_DSL.equals(buildToolEnum)) {
            if (containsAtLeastOneGradleFile) {
                throw new MojoExecutionException("Adding subprojects to gradle projects is not implemented.");
            } else if (pom != null && pom.isFile()) {
                throw new MojoExecutionException(
                        "You are trying to create gradle project in a directory that contains only maven build files.");
            }
        }

        askTheUserForMissingValues();
        if (!DEFAULT_ARTIFACT_ID.equals(projectArtifactId) && !OK_ID.matcher(projectArtifactId).matches()) {
            throw new MojoExecutionException(String.format(BAD_IDENTIFIER, "artifactId", projectArtifactId));
        }
        if (!DEFAULT_GROUP_ID.equals(projectGroupId) && !OK_ID.matcher(projectGroupId).matches()) {
            throw new MojoExecutionException(String.format(BAD_IDENTIFIER, "groupId", projectGroupId));
        }

        projectRoot = new File(outputDirectory, projectArtifactId);
        if (projectRoot.exists()) {
            throw new MojoExecutionException("Unable to create the project, " +
                    "the directory " + projectRoot.getAbsolutePath() + " already exists");
        }

        boolean success;
        final Path projectDirPath = projectRoot.toPath();
        try {
            extensions = CreateProjectHelper.sanitizeExtensions(extensions);
            catalog = CreateProjectHelper.completeCatalog(catalog, extensions, mvn);
            sanitizeOptions();

            final List<ResourceLoader> codestartsResourceLoader = codestartLoadersBuilder(log)
                    .catalog(catalog)
                    .artifactResolver(mvn)

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use a valid reverse-domain groupId, e.g. -DprojectGroupId=com.example.myteam
  2. Re-run and correct the value at the interactive prompt
  3. Normalize the groupId in scripts (lowercase, dots instead of spaces/slashes)

Example fix

// before
mvn quarkus:create -DprojectGroupId="com example"
// after
mvn quarkus:create -DprojectGroupId=com.example
Defensive patterns

Strategy: validation

Validate before calling

Pattern OK_ID = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)*$");
if (!OK_ID.matcher(groupId).matches()) throw new IllegalArgumentException("Invalid groupId: " + groupId);

Try / catch

try {
    runCreateGoal();
} catch (MojoExecutionException e) {
    if (e.getMessage().contains("groupId")) {
        // retry with a reverse-domain style groupId
    }
}

Prevention

When it happens

Trigger: `mvn quarkus:create -DprojectGroupId="com.example corp"` or entering an invalid groupId interactively.

Common situations: GroupIds containing spaces, underscores at bad positions, symbols like `#`, or team names with slashes; copy-paste errors from documentation.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/488d71b4cc4d884e. Report an issue: GitHub.