quarkusio/quarkus · error · MojoExecutionException

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

Error message

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

What it means

ExtensionDescriptorMojo writes the generated quarkus-extension.json descriptor via Files.newBufferedWriter and Jackson writer. An IOException while opening/writing this file is wrapped in a MojoExecutionException naming the quarkus-extension.json path inside META-INF.

Source

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

        addSource(extObject);
        addExtensionDependencies(extObject);

        completeCodestartArtifact(mapper, extObject);

        try {
            ExtensionMetadataValidator.validate(extObject);
        } catch (IOException e) {
            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()) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run mvn clean and rebuild to reset target state
  2. Check disk space and file permissions on the module's target/classes/META-INF directory
  3. Ensure no concurrent build writes to the same module (no parallel -T runs of the same reactor)
Defensive patterns

Strategy: try-catch

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: Files.newBufferedWriter or bw.write throws IOException — the META-INF directory was not created/readable, the target file is locked, disk is full, or permissions deny writing.

Common situations: CI disk full; read-only volume mounts; antivirus or container runtimes locking files in target; concurrent builds racing on the same target directory.

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/2ad71821dc4cf243. Report an issue: GitHub.