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
AddExtensionMojo.validateParameters enforces that exactly one of the mutually exclusive parameters `extension` (single) or `extensions` (list) is provided. Throwing when neither is set or when both are set, since the mojo cannot unambiguously decide which extensions to add.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/AddExtensionMojo.java:44
public class AddExtensionMojo extends QuarkusProjectMojoBase {
/**
* The list of extensions to be added.
*/
@Parameter(property = "extensions")
Set<String> extensions;
/**
* For usability reason, this parameter allows adding 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(String::trim).collect(toSet()));
}
try {
AddExtensions addExtensions = new AddExtensions(quarkusProject)
.extensions(ext.stream().map(String::trim).collect(toSet()));View on GitHub (pinned to e1c734241f)
Solutions
- Pass exactly one: `mvn quarkus:add-extension -Dextensions=hibernate-orm,rest` or `-Dextension=hibernate-orm`.
- Remove the duplicate parameter if both were supplied.
- In pom.xml configuration, configure either <extensions> or <extension>, not both.
Example fix
// before mvn quarkus:add-extension -Dextension=agenda -Dextensions=hibernate-orm // after mvn quarkus:add-extension -Dextensions=agenda,hibernate-orm
Defensive patterns
Strategy: validation
Validate before calling
if (project.hasProperty('extension') && project.hasProperty('extensions')) throw new IllegalArgumentException('Use only -Dextension or -Dextensions, not both') Try / catch
try { ... } catch (MojoExecutionException e) { getLog().error('Pass exactly one of -Dextension or -Dextensions: ' + e.getMessage()); } Prevention
- Standardize on -Dextensions (plural) in scripts and CI.
- Document allowed parameter forms in the project README.
- Validate CLI scripts with a shellcheck/lint step.
When it happens
Trigger: Running `mvn quarkus:add-extension` with no -Dextension/-Dextensions parameters, or supplying both -Dextension=x and -Dextensions=a,b at the same time.
Common situations: Forgetting to pass -Dextensions on the command line; CI scripts passing both forms after copy-paste; empty `extensions` property combining with a blank `extension`.
Related errors
- This goal requires a Quarkus extension registry client to be
- Unsupported format: ${format}
- Cannot specify both class and method name
- The project artifact's extension is '${extension}' while thi
- Specifying a stream requires the Quarkus extension registry
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/31d6fec587b98cfd.
Report an issue: GitHub.