OpenAPITools/openapi-generator · error · RuntimeException
Build tool "{buildTool}" is not supported or misspelled.
Error message
Build tool "{buildTool}" is not supported or misspelled. What it means
Thrown by JavaMicronautAbstractCodegen.processOpts when the buildTool additional property is present but not one of the Micronaut generator's supported values: 'gradle', 'maven', or 'all' (both build files). The switch on the raw string has no looser fallback, so any typo or unsupported tooling rejects generation before templates render. A sibling switch validates testTool as 'junit' or 'spock' the same way.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java:275
this.wrapInHttpResponse = convertPropertyToBoolean(OPT_WRAP_IN_HTTP_RESPONSE);
}
writePropertyBack(OPT_WRAP_IN_HTTP_RESPONSE, wrapInHttpResponse);
if (additionalProperties.containsKey(OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG)) {
this.generateOperationOnlyForFirstTag = convertPropertyToBoolean(OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG);
}
writePropertyBack(OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG, generateOperationOnlyForFirstTag);
// Get enum properties
if (additionalProperties.containsKey(OPT_BUILD)) {
switch ((String) additionalProperties.get(OPT_BUILD)) {
case OPT_BUILD_GRADLE:
case OPT_BUILD_MAVEN:
case OPT_BUILD_ALL:
this.buildTool = (String) additionalProperties.get(OPT_BUILD);
break;
default:
throw new RuntimeException("Build tool \"" + additionalProperties.get(OPT_BUILD) + "\" is not supported or misspelled.");
}
}
additionalProperties.put(OPT_BUILD, buildTool);
if (additionalProperties.containsKey(OPT_TEST)) {
switch ((String) additionalProperties.get(OPT_TEST)) {
case OPT_TEST_JUNIT:
case OPT_TEST_SPOCK:
this.testTool = (String) additionalProperties.get(OPT_TEST);
break;
default:
throw new RuntimeException("Test tool \"" + additionalProperties.get(OPT_TEST) + "\" is not supported or misspelled.");
}
}
additionalProperties.put(OPT_TEST, testTool);
if (testTool.equals(OPT_TEST_JUNIT)) {
additionalProperties.put("isTestJunit", true);
} else if (testTool.equals(OPT_TEST_SPOCK)) {View on GitHub (pinned to fcec517be3)
Solutions
- Use exactly one of: buildTool=gradle, buildTool=maven, or buildTool=all
- Check the testTool value too — only junit and spock are accepted
- For Kotlin-dsl Gradle files, generate with buildTool=gradle and rename/adjust the generated build script afterwards
- Verify values against `openapi-generator-cli config-help -g java-micronaut-server` after generator upgrades
Example fix
# before openapi-generator-cli generate -g java-micronaut-server -i api.yaml \ --additional-properties buildTool=gradlew # after openapi-generator-cli generate -g java-micronaut-server -i api.yaml \ --additional-properties buildTool=gradle
Defensive patterns
Strategy: validation
Validate before calling
Set<String> builds = Set.of("gradle", "maven", "all");
String buildTool = String.valueOf(opts.getOrDefault("buildTool", "gradle"));
if (!builds.contains(buildTool)) {
throw new IllegalArgumentException("buildTool must be one of " + builds + ", got: " + buildTool);
}
Set<String> tests = Set.of("junit", "spock");
String testTool = String.valueOf(opts.getOrDefault("testTool", "junit"));
if (!tests.contains(testTool)) {
throw new IllegalArgumentException("testTool must be one of " + tests + ", got: " + testTool);
} Try / catch
try {
generator.generate();
} catch (RuntimeException e) {
if (e.getMessage() != null && (e.getMessage().contains("Build tool") || e.getMessage().contains("Test tool"))) {
throw new ConfigException("Micronaut generator rejected buildTool/testTool: " + e.getMessage(), e);
}
throw e;
} Prevention
- Lowercase and whitelist buildTool/testTool values at config load time
- Use the tool names (maven, gradle), not binary names (mvn, gradlew)
- For Kotlin-dsl Gradle, generate with 'gradle' and post-process the script rather than inventing unsupported values
When it happens
Trigger: Passing --additional-properties buildTool=gradlew, buildTool=gradle-kotlin, buildTool=mvn, or empty string to -g java-micronaut* generators (client/server). Also triggered via Gradle plugin configOptions { buildTool = 'Gradle' } with wrong casing from Groovy configs, or stale config files using values removed in newer generator versions.
Common situations: Maven users type the mvn binary name instead of 'maven'. Kotlin-DSL Gradle users expect 'gradle-kotlin'/'kotlin' support that does not exist and must post-process the .gradle output. Case sensitivity bites when the value comes from a templated CI variable ('Gradle').
Related errors
- Both %s and %s properties were set with different value.
- Helidon version %s uses the %s prefix for EE dependencies bu
- useJackson3 is only supported for the 'native', 'apache-http
- Invalid microprofileFramework '{microprofileFramework}'. Mus
- Version %s of MicroProfile Rest Client is not supported or i
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/4d08247eddbde806.
Report an issue: GitHub.