quarkusio/quarkus · error · MojoExecutionException

Failed to generate Extension

Error message

Failed to generate Extension

What it means

Wraps a QuarkusCommandException raised inside CreateExtension.execute() — the actual extension scaffolding command — into a MojoExecutionException. It means the generation command aborted with an exception (template rendering, file writes, validation) rather than returning a normal failure.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/CreateExtensionMojo.java:300

                .packageName(packageName)
                .namespaceId(namespaceId)
                .namespaceName(namespaceName)
                .quarkusVersion(quarkusVersion)
                .quarkusBomGroupId(quarkusBomGroupId)
                .quarkusBomArtifactId(quarkusBomArtifactId)
                .quarkusBomVersion(quarkusBomVersion)
                .javaVersion(javaVersion)
                .withCodestart(withCodestart)
                .withoutUnitTest(withoutTests || withoutUnitTest)
                .withoutDevModeTest(withoutTests || withoutDevModeTest)
                .withoutIntegrationTests(withoutTests || withoutIntegrationTests);

        boolean success;

        try {
            success = createExtension.execute().isSuccess();
        } catch (QuarkusCommandException e) {
            throw new MojoExecutionException("Failed to generate Extension", e);
        }

        if (!success) {
            throw new MojoExecutionException("Failed to generate Extension");
        }
    }

    private void autoComputeQuarkiverseExtensionId() {
        if (isQuarkiverseGroupId(groupId) && isEmpty(extensionId)) {
            extensionId = extractQuarkiverseExtensionId(groupId);
        }
    }

    private String getPluginVersion() throws MojoExecutionException {
        return CreateUtils.resolvePluginInfo(CreateExtensionMojo.class).getVersion();
    }

    private void promptValues() throws MojoExecutionException {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the chained QuarkusCommandException cause in the Maven log for the concrete file/IO failure
  2. Ensure the target directory (-Dbasedir / cwd) is writable and does not already contain the extension
  3. Update or reinstall the Quarkus Maven plugin (corrupted plugin jar breaks template loading)
  4. Retry in a fresh empty directory to rule out leftover files

Example fix

// before
mvn quarkus:create-extension  // run in existing dir with stale files
// after
mkdir fresh-ext && cd fresh-ext && mvn quarkus:create-extension -DextensionId=my-ext
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure target is writable before generation
java.nio.file.Path dir = java.nio.file.Path.of("").toAbsolutePath();
if (!java.nio.file.Files.isWritable(dir))
    throw new IllegalStateException("Target directory not writable: " + dir);

Try / catch

try {
    mvn quarkus:create-extension ...
} catch (MojoExecutionException e) {
    if (e.getCause() instanceof QuarkusCommandException qce) {
        logger.error("Generation aborted: {}", qce.getCause(), qce); // fix IO/template cause
    }
}

Prevention

When it happens

Trigger: createExtension.execute() throws QuarkusCommandException during quarkus:create-extension — typically template copy/render failures or I/O errors while writing the new extension project.

Common situations: Target directory not writable or already contains conflicting files, template resources missing from the classpath (corrupt/quarantined plugin jar), unusual file-system permissions (NFS, read-only dir).

Related errors


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