quarkusio/quarkus · critical · MojoExecutionException

Failed to generate Quarkus project

Error message

Failed to generate Quarkus project

What it means

CreateProjectMojo.execute wraps the entire project generation (template rendering, POM writing, file creation) in a broad try/catch and rethrows any Exception as a MojoExecutionException with this message. It means the Maven 'quarkus:create' goal failed while materializing the new Quarkus project on disk. The original cause is attached, so the root problem (IO error, template failure, bad coordinates) is in the 'Caused by' chain.

Source

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

            success = createProject.execute().isSuccess();
            if (success && parentPomModel != null && BuildTool.MAVEN.equals(buildToolEnum)) {
                // Write to parent pom and submodule pom if project creation is successful
                if (!parentPomModel.getModules().contains(this.projectArtifactId)) {
                    parentPomModel.addModule(this.projectArtifactId);
                }
                File subModulePomFile = new File(projectRoot, buildToolEnum.getDependenciesFile());
                Model subModulePomModel = MojoUtils.readPom(subModulePomFile);
                Parent parent = new Parent();
                parent.setGroupId(parentPomModel.getGroupId());
                parent.setArtifactId(parentPomModel.getArtifactId());
                parent.setVersion(parentPomModel.getVersion());
                subModulePomModel.setParent(parent);
                MojoUtils.writeFormatted(parentPomModel, pom);
                MojoUtils.writeFormatted(subModulePomModel, subModulePomFile);
            }
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to generate Quarkus project", e);
        }
        if (success) {
            printUserInstructions(projectRoot);
        } else {
            throw new MojoExecutionException(
                    "The project was created but (some of) the requested extensions couldn't be added.");
        }
    }

    private ExtensionCatalogResolver getExtensionCatalogResolver(MavenArtifactResolver mvn, MojoMessageWriter log) {
        if (!QuarkusProjectHelper.isRegistryClientEnabled()) {
            return ExtensionCatalogResolver.empty();
        }
        ExtensionCatalogResolver catalogResolver;
        try {
            catalogResolver = QuarkusProjectHelper.getCatalogResolver(mvn, log);
            if (refresh) {
                getLog().debug("Clearing local extension catalog cache");

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the full 'Caused by' chain of the MojoExecutionException to find the real cause
  2. Verify the target directory exists, is writable, and does not already contain a conflicting project
  3. Run with -e (show stack trace) and -U (force update) to refresh resolution of quarkus-bom artifacts
  4. Check Maven settings.xml repositories/mirrors/proxy configuration
  5. Retry after clearing the specific corrupted artifact under ~/.m2/repository

Example fix

# before
cd /existing-project && mvn quarkus:create
# after: run in an empty directory or specify a fresh dir
mkdir my-app && cd my-app && mvn io.quarkus.platform:quarkus-maven-plugin:create -DprojectArtifactId=my-app
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-checks before running create
Path target = Path.of(dir);
if (Files.exists(target) && !isEmptyDirectory(target)) throw new IllegalStateException("Target dir not empty: " + dir);
if (!Files.isWritable(target.getParent())) throw new IllegalStateException("Not writable: " + target.getParent());

Try / catch

// Maven CLI: no code-level catch; inspect cause chain
mvn quarkus:create -e
// In Mojo code: MojoExecutionException has a cause — always log/inspect getCause() recursively

Prevention

When it happens

Trigger: Running `mvn io.quarkus:quarkus-maven-plugin:create ...` where any exception occurs during project generation: unresolvable parent artifacts, inability to write files, template resource failures, or any unexpected exception inside the execute() body before the success flag is checked.

Common situations: Read-only or existing non-empty target directory; corrupted local Maven repository causing artifact resolution failure; wrong -DprojectGroupId/-DprojectVersion values; proxy or repository misconfiguration blocking downloads of the platform BOM.

Related errors


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