apache/maven · warning · InvalidVersionSpecificationException

Ranges overlap: {}

Error message

Ranges overlap: {}

What it means

maven.ext.class.path was found among the JVM system properties, meaning the value came from -D on the java command line (MAVEN_OPTS or JAVA_TOOL_OPTIONS) rather than from Maven user properties. That route is deprecated; the supported locations are a -D argument on the mvn command line (user properties) or ${session.rootDirectory}/.mvn/maven-user.properties.

Source

Thrown at compat/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java:133

            int index = index2;
            if (index2 < 0 || index1 < index2) {
                if (index1 >= 0) {
                    index = index1;
                }
            }

            if (index < 0) {
                throw new InvalidVersionSpecificationException("Unbounded range: " + spec);
            }

            Restriction restriction = parseRestriction(process.substring(0, index + 1));
            if (lowerBound == null) {
                lowerBound = restriction.getLowerBound();
            }
            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);

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Pass it as a Maven argument: mvn -Dmaven.ext.class.path=/path/to/ext.jar ...
  2. Or persist it in .mvn/maven-user.properties at the project root, the documented location
  3. Remove the -D from MAVEN_OPTS and JAVA_TOOL_OPTIONS so it is no longer read as a system property

Example fix

# before
export MAVEN_OPTS=-Dmaven.ext.class.path=/tmp/extensions/my-ext.jar
mvn clean verify
# after: passed as a Maven user property
mvn -Dmaven.ext.class.path=/tmp/extensions/my-ext.jar clean verify
# or persisted in .mvn/maven-user.properties:
# maven.ext.class.path=/tmp/extensions/my-ext.jar
Defensive patterns

Strategy: validation

Validate before calling

case $MAVEN_OPTS$JAVA_TOOL_OPTIONS in
  *maven.ext.class.path*)
    echo 'move -Dmaven.ext.class.path to the mvn command line or .mvn/maven-user.properties'
    exit 1 ;;
esac

Prevention

When it happens

Trigger: export MAVEN_OPTS='-Dmaven.ext.class.path=/path/to/ext.jar' before running mvn, or the same property injected through JAVA_TOOL_OPTIONS by CI infrastructure.

Common situations: Docker images and CI templates baking Maven tuning into MAVEN_OPTS; teams moving from old Maven versions where system properties were the only option.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/ea19c5370499b323. Report an issue: GitHub.