quarkusio/quarkus · error · MojoExecutionException

Failed to ensure Quarkus Maven version compatibility

Error message

Failed to ensure Quarkus Maven version compatibility

What it means

This MojoExecutionException is thrown by MavenVersionEnforcer.ensureMavenVersion when it cannot determine which Maven versions the current Quarkus build supports. The failure wraps an IOException coming from getSupportedMavenVersions (reading quarkus.properties), so the build stops before any goal runs. It is a fail-fast compatibility gate between the detected Maven runtime and Quarkus.

Source

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

import java.util.Properties;

import javax.inject.Named;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.versioning.*;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;

@Named
public class MavenVersionEnforcer {

    public void ensureMavenVersion(Log log, MavenSession session) throws MojoExecutionException {
        final String supported;
        try {
            supported = getSupportedMavenVersions();
        } catch (IOException e) {
            throw new MojoExecutionException("Failed to ensure Quarkus Maven version compatibility", e);
        }
        String mavenVersion = session.getSystemProperties().getProperty("maven.version");
        if (log.isDebugEnabled()) {
            log.debug("Detected Maven Version: " + mavenVersion);
        }
        DefaultArtifactVersion detectedVersion = new DefaultArtifactVersion(mavenVersion);
        enforce(log, supported, detectedVersion);
    }

    private static String getSupportedMavenVersions() throws IOException {
        return loadQuarkusProperties().getProperty("supported-maven-versions");
    }

    private static Properties loadQuarkusProperties() throws IOException {
        final String resource = "quarkus.properties";
        try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)) {
            if (is == null) {
                throw new IOException("Could not locate " + resource + " on the classpath");

View on GitHub (pinned to e1c734241f)

Solutions

  1. Delete the quarkus-maven-plugin artifacts from the local repository (~/.m2/repository/io/quarkus/quarkus-maven-plugin) and rebuild so Maven re-downloads them
  2. Update quarkus-maven-plugin and Quarkus dependencies to a consistent release (e.g. via ./mvnw io.quarkus:quarkus-maven-plugin:update or matching versions in pom.xml)
  3. Run with ./mvnw -U to force refresh of plugin snapshots/releases
  4. Check that no custom classloader configuration (extensions.conf, MAVEN_OPTS) breaks loading resources from the plugin classpath

Example fix

// before (broken, corrupted local plugin jar)
mvn quarkus:dev
// after
rm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin
./mvnw -U quarkus:dev
Defensive patterns

Strategy: try-catch

Validate before calling

java.util.Properties p = new java.util.Properties();
try (var is = Thread.currentThread().getContextClassLoader()
        .getResourceAsStream("quarkus.properties")) {
    if (is == null) throw new IllegalStateException("quarkus-maven-plugin jar missing/corrupted in ~/.m2");
    p.load(is);
}
if (p.getProperty("maven.version.range") == null) throw new IllegalStateException("plugin jar incomplete");

Try / catch

try {
    enforcer.ensureMavenVersion(log, session);
} catch (MojoExecutionException e) {
    if (e.getCause() instanceof IOException) {
        log.warn("Plugin jar corrupted; run: rm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin && mvn -U");
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling ensureMavenVersion (e.g. from Quarkus Maven plugin goals) when getSupportedMavenVersions() throws IOException — specifically when quarkus.properties cannot be located on the classpath or cannot be loaded/parsed.

Common situations: A corrupted or incomplete quarkus-maven-plugin jar in the local repository (missing quarkus.properties resource); running with an exotic classloader setup where the thread context classloader cannot see plugin resources; partial/failed plugin download leaving a truncated artifact in ~/.m2.

Related errors


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