{"record":{"id":"7af2458212b7ae93","repo":"quarkusio/quarkus","slug":"could-not-locate-quarkus-properties-on-the-classpa","errorCode":null,"errorMessage":"Could not locate quarkus.properties on the classpath","messagePattern":"Could not locate quarkus\\.properties on the classpath","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/components/MavenVersionEnforcer.java","lineNumber":42,"sourceCode":"            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\");\n            }\n            final Properties props = new Properties();\n            try {\n                props.load(is);\n            } catch (IOException e) {\n                throw new IOException(\"Failed to load \" + resource + \" from the classpath\", e);\n            }\n            return props;\n        }\n    }\n\n    /**\n     * Compares the specified Maven version to see if it is allowed by the defined version range.\n     *\n     * @param log the log\n     * @param requiredMavenVersionRange range of allowed versions for Maven.\n     * @param actualMavenVersion the version to be checked.\n     * @throws MojoExecutionException the given version fails the enforcement rule","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/components/MavenVersionEnforcer.java#L24-L60","documentation":"loadQuarkusProperties throws this IOException when the resource 'quarkus.properties' cannot be found via Thread.currentThread().getContextClassLoader().getResourceAsStream. This file carries the Quarkus-supported Maven version range, so without it the enforcer cannot proceed. It is surfaced to users wrapped as 'Failed to ensure Quarkus Maven version compatibility'.","triggerScenarios":"Calling getSupportedMavenVersions (from ensureMavenVersion) while the thread context classloader cannot resolve quarkus.properties — typically because the quarkus-maven-plugin jar in the local repo is missing the resource or the classloader is not the plugin's.","commonSituations":"Corrupted/partially downloaded quarkus-maven-plugin artifact in ~/.m2; manually repackaged or shaded plugin jar; running code that calls MavenVersionEnforcer outside the Quarkus Maven plugin so the resource is not on the context classloader.","solutions":["Delete and re-download the plugin: rm -rf ~/.m2/repository/io/quarkus/quarkus-maven-plugin then run ./mvnw -U <goal>","Ensure you invoke the enforcer through the quarkus-maven-plugin rather than embedding MavenVersionEnforcer in your own plugin without a dependency on the quarkus-maven-plugin jar","Verify the plugin jar contains quarkus.properties: unzip -l ~/.m2/repository/io/quarkus/quarkus-maven-plugin/<ver>/quarkus-maven-plugin-<ver>.jar | grep quarkus.properties","Use a full official Quarkus release and matching plugin version in pom.xml"],"exampleFix":"// before (calling enforcer from a custom plugin without the resource on classpath)\nnew MavenVersionEnforcer().ensureMavenVersion(log, session);\n// after (depend on quarkus-maven-plugin so quarkus.properties is packaged, or run it via the Quarkus plugin)\n<plugin>\n  <groupId>io.quarkus</groupId>\n  <artifactId>quarkus-maven-plugin</artifactId>\n  <version>${quarkus.version}</version>\n</plugin>","handlingStrategy":"validation","validationCode":"try (var is = Thread.currentThread().getContextClassLoader()\n        .getResourceAsStream(\"quarkus.properties\")) {\n    if (is == null) throw new IllegalStateException(\"quarkus.properties not on classpath; reinstall quarkus-maven-plugin\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare quarkus-maven-plugin as a dependency when embedding the enforcer","Verify jar contents with unzip -l before custom distributions","Use official Quarkus releases","Force re-download with -U when artifacts look suspicious"],"tags":["maven","quarkus","classpath","resource-missing"],"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"}