quarkusio/quarkus · error · MojoExecutionException

<detected Maven version> is not supported, it must be in <re

Error message

<detected Maven version> is not supported, it must be in <requiredMavenVersionRange>.

What it means

This MojoExecutionException is thrown by enforce when the detected Maven runtime version does not fall inside the required version range declared by Quarkus (e.g. [3.6.2,)). It is the actual 'your Maven is too old/new' failure of the compatibility gate. The message interpolates the detected version and the required range.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/components/MavenVersionEnforcer.java:72

    /**
     * Compares the specified Maven version to see if it is allowed by the defined version range.
     *
     * @param log the log
     * @param requiredMavenVersionRange range of allowed versions for Maven.
     * @param actualMavenVersion the version to be checked.
     * @throws MojoExecutionException the given version fails the enforcement rule
     */
    private void enforce(Log log,
            String requiredMavenVersionRange, ArtifactVersion actualMavenVersion)
            throws MojoExecutionException {
        if (StringUtils.isBlank(requiredMavenVersionRange)) {
            throw new MojoExecutionException("Maven version can't be empty.");
        }
        if (!actualMavenVersion.toString().equals(requiredMavenVersionRange)) {
            try {
                final VersionRange vr = VersionRange.createFromVersionSpec(requiredMavenVersionRange);
                if (!containsVersion(vr, actualMavenVersion)) {
                    throw new MojoExecutionException(getDetectedVersionStr(actualMavenVersion.toString())
                            + " is not supported, it must be in " + vr + ".");
                }
            } catch (InvalidVersionSpecificationException e) {
                throw new MojoExecutionException("The requested Maven version "
                        + requiredMavenVersionRange + " is invalid.", e);
            }
        }
        if (log.isDebugEnabled()) {
            log.debug(
                    getDetectedVersionStr(actualMavenVersion.toString()) + " is allowed in " + requiredMavenVersionRange + ".");
        }
    }

    /**
     * Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently, the default
     * <code>containsVersion</code> method assumes a singular version means allow everything.
     *
     * @param allowedRange range of allowed versions.

View on GitHub (pinned to e1c734241f)

Solutions

  1. Upgrade Maven to a version within the range (use ./mvnw — the Quarkus Maven wrapper — or install Maven >= the minimum stated in the message)
  2. Set toolchains/CI image to a supported Maven version (e.g. actions/setup-java with maven 3.9.x)
  3. If a brand-new Maven is wrongly excluded, check for a newer Quarkus release that widened the range and upgrade quarkus-maven-plugin
  4. Avoid overriding maven.version via -Dmaven.version=... which misreports the detected version

Example fix

// before (CI uses old Maven)
- run: mvn quarkus:dev   // Maven 3.5.4 -> not supported
// after
- run: ./mvnw quarkus:dev   # project wrapper, supported Maven version
Defensive patterns

Strategy: validation

Validate before calling

import org.apache.maven.artifact.versioning.*;
String required = "[3.6.2,)";
String actual = System.getProperty("maven.version");
if (!VersionRange.createFromVersionSpec(required)
        .containsVersion(new DefaultArtifactVersion(actual))) {
    throw new IllegalStateException("Maven " + actual + " unsupported; use ./mvnw or upgrade Maven to " + required);
}

Try / catch

try {
    enforcer.ensureMavenVersion(log, session);
} catch (MojoExecutionException e) {
    if (e.getMessage() != null && e.getMessage().contains("is not supported")) {
        log.error("Switch to ./mvnw or install a Maven version within the required range.");
    }
    throw e;
}

Prevention

When it happens

Trigger: ensureMavenVersion → enforce is called; actualMavenVersion is outside VersionRange.createFromVersionSpec(requiredMavenVersionRange); note the check is skipped entirely if the actual version string exactly equals the range spec.

Common situations: Using a system Maven older than the Quarkus minimum (e.g. Maven 3.5 with Quarkus requiring 3.6.2+); using a very new Maven the range excludes; CI images pinned to outdated Maven; wrapper not used and developer's local Maven differs.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/5908fb96db9c7043. Report an issue: GitHub.