quarkusio/quarkus · error · MojoExecutionException

Failed to persist ${output.resolve(BootstrapConstants.QUARKU

Error message

Failed to persist ${output.resolve(BootstrapConstants.QUARKUS_EXTENSION_JSON_FILE_NAME)}

What it means

Immediately after writing quarkus-extension.json, ExtensionDescriptorMojo writes the human-readable quarkus-extension.properties (QUARKUS_EXTENSION_JSON_FILE_NAME is the JSON variant at this site) using the non-pretty mapper. An IOException while writing that file is wrapped in a MojoExecutionException naming the file path.

Source

Thrown at independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java:394

            throw new MojoExecutionException(e.getMessage(), e.getCause());
        }

        final DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
        prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);

        try (BufferedWriter bw = Files
                .newBufferedWriter(output.resolve(BootstrapConstants.QUARKUS_EXTENSION_FILE_NAME))) {
            bw.write(getMapper(true).writer().with(prettyPrinter).writeValueAsString(extObject));
        } catch (IOException e) {
            throw new MojoExecutionException(
                    "Failed to persist " + output.resolve(BootstrapConstants.QUARKUS_EXTENSION_FILE_NAME), e);
        }

        try (BufferedWriter bw = Files
                .newBufferedWriter(output.resolve(BootstrapConstants.QUARKUS_EXTENSION_JSON_FILE_NAME))) {
            bw.write(getMapper(false).writer().with(prettyPrinter).writeValueAsString(extObject));
        } catch (IOException e) {
            throw new MojoExecutionException(
                    "Failed to persist " + output.resolve(BootstrapConstants.QUARKUS_EXTENSION_JSON_FILE_NAME), e);
        }
    }

    private void recordDevModeConfig(Properties props) {
        if (devMode == null) {
            return;
        }
        var jvmArgs = devMode.getJvmOptions();
        if (jvmArgs != null && !jvmArgs.isEmpty()) {
            jvmArgs.setAsExtensionDevModeProperties(props);
        }
        jvmArgs = devMode.getXxJvmOptions();
        if (jvmArgs != null && !jvmArgs.isEmpty()) {
            jvmArgs.setAsExtensionDevModeProperties(props);
        }
        if (devMode.hasLockedXxJvmOptions()) {
            props.setProperty(BootstrapConstants.EXT_DEV_MODE_LOCK_XX_JVM_OPTIONS,

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run mvn clean and retry the build
  2. Check disk space and permissions on target/classes/META-INF
  3. Exclude target/ from antivirus/indexing tools that can lock files
Defensive patterns

Strategy: try-catch

Validate before calling

Path out = targetDir.resolve("classes/META-INF");
Files.createDirectories(out);
if (!Files.isWritable(out)) throw new IllegalStateException("META-INF not writable");

Try / catch

try {
  invoker.executeMaven("extension-descriptor");
} catch (MojoExecutionException e) {
  if (String.valueOf(e.getCause()).contains("quarkus-extension.properties")) { runMaven("clean"); retry(); }
  else throw e;
}

Prevention

When it happens

Trigger: Files.newBufferedWriter or the write of the JSON file throws IOException during the extension-descriptor goal — same root causes as the sibling persist failures (disk, permissions, locked files).

Common situations: Read-only target/ in container builds; NFS stale handles on CI; disk quota exhausted mid-build after earlier files were written successfully.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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