{"record":{"id":"78aba1f25b2d5b1a","repo":"quarkusio/quarkus","slug":"failed-to-ensure-quarkus-maven-version-compatibili","errorCode":null,"errorMessage":"Failed to ensure Quarkus Maven version compatibility","messagePattern":"Failed to ensure Quarkus Maven version compatibility","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/components/MavenVersionEnforcer.java","lineNumber":24,"sourceCode":"import java.util.Properties;\n\nimport javax.inject.Named;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.apache.maven.artifact.versioning.*;\nimport org.apache.maven.execution.MavenSession;\nimport org.apache.maven.plugin.MojoExecutionException;\nimport org.apache.maven.plugin.logging.Log;\n\n@Named\npublic class MavenVersionEnforcer {\n\n    public void ensureMavenVersion(Log log, MavenSession session) throws MojoExecutionException {\n        final String supported;\n        try {\n            supported = getSupportedMavenVersions();\n        } catch (IOException e) {\n            throw new MojoExecutionException(\"Failed to ensure Quarkus Maven version compatibility\", e);\n        }\n        String mavenVersion = session.getSystemProperties().getProperty(\"maven.version\");\n        if (log.isDebugEnabled()) {\n            log.debug(\"Detected Maven Version: \" + mavenVersion);\n        }\n        DefaultArtifactVersion detectedVersion = new DefaultArtifactVersion(mavenVersion);\n        enforce(log, supported, detectedVersion);\n    }\n\n    private static String getSupportedMavenVersions() throws IOException {\n        return loadQuarkusProperties().getProperty(\"supported-maven-versions\");\n    }\n\n    private static Properties loadQuarkusProperties() throws IOException {\n        final String resource = \"quarkus.properties\";\n        try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)) {\n            if (is == null) {\n                throw new IOException(\"Could not locate \" + resource + \" on the classpath\");","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/components/MavenVersionEnforcer.java#L6-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Delete the quarkus-maven-plugin artifacts from the local repository (~/.m2/repository/io/quarkus/quarkus-maven-plugin) and rebuild so Maven re-downloads them","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)","Run with ./mvnw -U to force refresh of plugin snapshots/releases","Check that no custom classloader configuration (extensions.conf, MAVEN_OPTS) breaks loading resources from the plugin classpath"],"exampleFix":"// before (broken, corrupted local plugin jar)\nmvn quarkus:dev\n// after\nrm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin\n./mvnw -U quarkus:dev","handlingStrategy":"try-catch","validationCode":"java.util.Properties p = new java.util.Properties();\ntry (var is = Thread.currentThread().getContextClassLoader()\n        .getResourceAsStream(\"quarkus.properties\")) {\n    if (is == null) throw new IllegalStateException(\"quarkus-maven-plugin jar missing/corrupted in ~/.m2\");\n    p.load(is);\n}\nif (p.getProperty(\"maven.version.range\") == null) throw new IllegalStateException(\"plugin jar incomplete\");","typeGuard":null,"tryCatchPattern":"try {\n    enforcer.ensureMavenVersion(log, session);\n} catch (MojoExecutionException e) {\n    if (e.getCause() instanceof IOException) {\n        log.warn(\"Plugin jar corrupted; run: rm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin && mvn -U\");\n    }\n    throw e;\n}","preventionTips":["Use ./mvnw wrapper for all builds","Keep plugin and BOM versions aligned","Run mvn -U after interrupted downloads","Avoid shading or repackaging the Quarkus plugin"],"tags":["maven","quarkus","build","classloading"],"backgroundTag":"maven-plugin-classpath-resource-missing","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}