quarkusio/quarkus · error · MojoExecutionException

Unable to update the pom.xml file

Error message

Unable to update the pom.xml file

What it means

AddExtensionMojo.doExecute wraps any exception thrown while running AddExtensions (or updating the build file) into this MojoExecutionException with the original cause attached. It signals the pom.xml/build file update step failed, not that the extension lookup itself failed.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/AddExtensionMojo.java:68

            throws MojoExecutionException {
        Set<String> ext = new HashSet<>();
        if (extensions != null && !extensions.isEmpty()) {
            ext.addAll(extensions);
        } else {
            // Parse the "extension" just in case it contains several comma-separated values
            // https://github.com/quarkusio/quarkus/issues/2393
            ext.addAll(Arrays.stream(extension.split(",")).map(String::trim).collect(toSet()));
        }

        try {
            AddExtensions addExtensions = new AddExtensions(quarkusProject)
                    .extensions(ext.stream().map(String::trim).collect(toSet()));
            final QuarkusCommandOutcome outcome = addExtensions.execute();
            if (!outcome.isSuccess()) {
                throw new MojoExecutionException("Unable to add extensions");
            }
        } catch (Exception e) {
            throw new MojoExecutionException("Unable to update the pom.xml file", e);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the 'Caused by' chain of this exception for the root cause.
  2. Validate pom.xml is well-formed and writable (check file permissions, IDE locks).
  3. Re-run the command in a clean checkout to rule out corrupted build files.
Defensive patterns

Strategy: try-catch

Validate before calling

if (!Files.isWritable(Path.of('pom.xml'))) throw new IllegalStateException('pom.xml is not writable')

Try / catch

catch (MojoExecutionException e) { Throwable root = e; while (root.getCause() != null) root = root.getCause(); log.error('Root cause: ' + root); }

Prevention

When it happens

Trigger: Any Exception from addExtensions.execute() or the surrounding code — e.g. I/O errors reading/writing pom.xml, invalid XML, or errors inside the Quarkus project machinery.

Common situations: Malformed or locked pom.xml; running from a directory where pom.xml is read-only; custom build file layouts the tool cannot parse.

Related errors


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