apache/maven · warning · InvalidVersionSpecificationException
Only fully-qualified sets allowed in multiple set scenario:
Error message
Only fully-qualified sets allowed in multiple set scenario: {} What it means
Building the effective toolchains (user plus installation/project toolchains.xml) produced Problem entries. Maven prints this header followed by one 'message @ location' line per problem, then continues with whatever toolchains could be merged. A misdeclared toolchain can later fail to match a <toolchain> requirement in a plugin, silently falling back to default JDK/tool selection.
Source
Thrown at compat/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java:148
if (upperBound != null) {
if (restriction.getLowerBound() == null
|| restriction.getLowerBound().compareTo(upperBound) < 0) {
throw new InvalidVersionSpecificationException("Ranges overlap: " + spec);
}
}
restrictions.add(restriction);
upperBound = restriction.getUpperBound();
process = process.substring(index + 1).trim();
if (process.startsWith(",")) {
process = process.substring(1).trim();
}
}
if (!process.isEmpty()) {
if (!restrictions.isEmpty()) {
throw new InvalidVersionSpecificationException(
"Only fully-qualified sets allowed in multiple set scenario: " + spec);
} else {
version = new DefaultArtifactVersion(process);
restrictions.add(Restriction.EVERYTHING);
}
}
cached = new VersionRange(version, restrictions);
CACHE_SPEC.put(spec, cached);
return cached;
}
private static Restriction parseRestriction(String spec) throws InvalidVersionSpecificationException {
boolean lowerBoundInclusive = spec.startsWith("[");
boolean upperBoundInclusive = spec.endsWith("]");
String process = spec.substring(1, spec.length() - 1).trim();
View on GitHub (pinned to e4093d4e12)
Solutions
- Read each following 'message @ location' line to find the exact file and position
- Fix the reported entry in the toolchains.xml (usually ~/.m2/toolchains.xml or .mvn/toolchains.xml)
- Validate shape: xmllint --noout on the file; ensure each <toolchain> has <type> and the type-specific fields
- Re-run mvn and confirm the warning block disappears before relying on toolchain selection
Example fix
<!-- before -->
<toolchains>
<toolchain>
<type>jdk</type>
<provides><version>17</version></provides>
</toolchain>
</toolchains>
<!-- after: required jdkHome present -->
<toolchains>
<toolchain>
<type>jdk</type>
<provides><version>17</version></provides>
<configuration><jdkHome>/usr/lib/jvm/java-17</jdkHome></configuration>
</toolchain>
</toolchains> Defensive patterns
Strategy: validation
Validate before calling
xmllint --noout ~/.m2/toolchains.xml 2>/dev/null xmllint --noout .mvn/toolchains.xml 2>/dev/null echo 'toolchains XML validated'
Prevention
- Generate toolchains.xml with provisioning scripts instead of hand-editing
- Validate toolchains files in CI before the build stage
- Keep toolchain entries minimal: type plus the required home element
When it happens
Trigger: A toolchains.xml that is malformed, uses unknown elements, or declares a toolchain missing required fields (for example a jdk toolchain without a jdkHome).
Common situations: Hand-edited ~/.m2/toolchains.xml after JDK updates; CI provisioning toolchains files via templates with unfilled placeholders; conflicting user and project toolchains files.
Related errors
- Single version must be surrounded by []: {}
- The artifact has no valid ranges
- Cannot read toolchains file at " + userToolchainsFile.getAbs
- Provides token '" + key + "' doesn't have any value configur
- Java toolchain without the jdkHome configuration element.
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/d0993a15a5b32cdc.
Report an issue: GitHub.