quarkusio/quarkus · error · MojoExecutionException
Unable to remove extensions
Error message
Unable to remove extensions
What it means
RemoveExtensionMojo (mvn quarkus:remove-extension) throws this MojoExecutionException when the underlying RemoveExtensions command reports a non-success outcome. It means the Quarkus command framework refused to remove the requested extensions from the project (e.g. the extension is not a registered dependency, or the pom rewrite was not performed). Note the separate catch block rethrows a different message, so this specific error surfaces only when the command executed but returned isSuccess()==false.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/RemoveExtensionMojo.java:64
@Override
public void doExecute(final QuarkusProject quarkusProject, final MessageWriter log) 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(s -> s.trim()).collect(Collectors.toSet()));
}
try {
final QuarkusCommandOutcome outcome = new RemoveExtensions(quarkusProject)
.extensions(ext.stream().map(String::trim).collect(Collectors.toSet()))
.execute();
if (!outcome.isSuccess()) {
throw new MojoExecutionException("Unable to remove extensions");
}
} catch (Exception e) {
throw new MojoExecutionException("Unable to update the pom.xml file", e);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Verify the exact artifactId with `mvn quarkus:list-extensions` and retry with matching names
- Check the pom.xml: the extension must be a direct dependency to be removable; remove the transitive source instead
- Ensure the project has a Quarkus platform BOM/import configured
- Run with -X / -e to see the underlying cause logged by the command
Example fix
// before mvn quarkus:remove-extension -Dextensions=quarkus-hibernate-ormn // after mvn quarkus:list-extensions # confirm exact name mvn quarkus:remove-extension -Dextensions=quarkus-hibernate-orm
Defensive patterns
Strategy: validation
Validate before calling
// Before running the mojo, verify each extension is a direct dependency:
mvn quarkus:list-extensions | grep '<extension>'
// or programmatically:
boolean isDirect = project.getDependencies().stream()
.anyMatch(d -> d.getGroupId().equals("io.quarkus") && d.getArtifactId().equals(ext)); Try / catch
try { outcome = new RemoveExtensions(quarkusProject).extensions(names).execute();
if (!outcome.isSuccess()) { log.warn("Removal refused: check that extensions are direct dependencies"); } }
catch (MojoExecutionException e) { log.error("remove-extension failed: {}", e.getMessage(), e); } Prevention
- Run `mvn quarkus:list-extensions` first and copy names exactly
- Only remove direct dependencies; remove transitive ones at their source
- Keep a platform BOM import in the pom so the command can operate
- Commit the pom before removal so a bad rewrite can be reverted with git checkout
When it happens
Trigger: Running `mvn quarkus:remove-extension -Dextensions=<list>` where ext names do not match installed extensions, or RemoveExtensions.execute() fails to modify the pom (e.g. the project has no Quarkus platform/BOM configured, or the extension is brought in transitively and cannot be removed directly).
Common situations: Typo in the extension artifactId; trying to remove an extension pulled in transitively by another dependency; removing the last platform dependency; running the goal in a project without a quarkus-maven-plugin-compatible pom setup.
Related errors
- Unable to parse pom file: ${pom}
- Could not resolve POM for
- Unable to add extensions
- Failed to initialize Maven artifact resolver
- You are trying to create a Maven project in a directory that
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/c69ee42aa5cad203.
Report an issue: GitHub.