quarkusio/quarkus · error · MojoExecutionException
Either the `extension` or `extensions` parameter must be set
Error message
Either the `extension` or `extensions` parameter must be set
What it means
This MojoExecutionException is thrown by RemoveExtensionMojo.validateParameters when the quarkus:remove-extension goal receives neither or both of the mutually exclusive extension parameters: single `extension` and list `extensions`. Exactly one must be provided; the goal refuses to guess the user's intent.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/RemoveExtensionMojo.java:43
public class RemoveExtensionMojo extends QuarkusProjectMojoBase {
/**
* The list of extensions to be removed.
*/
@Parameter(property = "extensions")
Set<String> extensions;
/**
* For usability reason, this parameter allows removing a single extension.
*/
@Parameter(property = "extension")
String extension;
@Override
protected void validateParameters() throws MojoExecutionException {
if ((StringUtils.isBlank(extension) && (extensions == null || extensions.isEmpty())) // None are set
|| (!StringUtils.isBlank(extension) && extensions != null && !extensions.isEmpty())) { // Both are set
throw new MojoExecutionException("Either the `extension` or `extensions` parameter must be set");
}
}
@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()))View on GitHub (pinned to e1c734241f)
Solutions
- Provide exactly one parameter: -Dextensions="rest,jackson" for multiple, or -Dextension="rest" for a single extension
- Remove the conflicting duplicate flag from the command line or .mvn/maven.config/CI defaults
- Configure the extension(s) in the plugin <configuration> block instead of mixing both properties
Example fix
// before mvn quarkus:remove-extension -Dextension="rest" -Dextensions="rest,jackson" // after mvn quarkus:remove-extension -Dextensions="rest,jackson"
Defensive patterns
Strategy: validation
Validate before calling
String extension = System.getProperty("extension");
String extensions = System.getProperty("extensions");
boolean noneSet = (extension == null || extension.isBlank()) && (extensions == null || extensions.isBlank());
boolean bothSet = extension != null && !extension.isBlank() && extensions != null && !extensions.isBlank();
if (noneSet || bothSet) {
throw new IllegalArgumentException("Set exactly one of -Dextension or -Dextensions");
} Prevention
- Standardize on -Dextensions for all add/remove-extension invocations
- Check .mvn/maven.config and CI defaults for conflicting flags
- Avoid mixing plugin <configuration> values with CLI properties
- Read the goal's help (mvn quarkus:help) before scripting parameterized invocations
When it happens
Trigger: Running mvn quarkus:remove-extension with no -Dextension/-Dextensions, or supplying both -Dextension="rest" and -Dextensions="rest,jackson" in the same invocation.
Common situations: Copy-pasting commands with leftover flags; CI scripts setting defaults in .mvn/maven.config that collide with explicit CLI args; forgetting the argument entirely.
Related errors
- Either the `extension` or `extensions` parameter must be set
- This goal requires a project
- This goal requires a Quarkus extension registry client to be
- Unable to determine groupId and artifactId of the jar that c
- Unable to determine groupId and artifactId of the extension
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/0d3d5519cd8f9bec.
Report an issue: GitHub.