{"record":{"id":"bf8764dba0776942","repo":"apache/maven","slug":"could-not-locate-meta-inf-maven-org-apache-maven-m","errorCode":null,"errorMessage":"Could not locate META-INF/maven/org.apache.maven/maven-core/pom.properties on classpath, Maven runtime information not available","messagePattern":"Could not locate META-INF/maven/org\\.apache\\.maven/maven-core/pom\\.properties on classpath, Maven runtime information not available","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"impl/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java","lineNumber":70,"sourceCode":"        this.versionScheme = versionScheme;\n        this.mavenVersion = loadMavenVersion();\n    }\n\n    @Override\n    public String getMavenVersion() {\n        return mavenVersion;\n    }\n\n    private String loadMavenVersion() {\n        Properties props = new Properties();\n\n        String resource = \"META-INF/maven/org.apache.maven/maven-core/pom.properties\";\n\n        try (InputStream is = DefaultRuntimeInformation.class.getResourceAsStream(\"/\" + resource)) {\n            if (is != null) {\n                props.load(is);\n            } else {\n                logger.warn(\"Could not locate \" + resource + \" on classpath, Maven runtime information not available\");\n            }\n        } catch (IOException e) {\n            String msg = \"Could not parse \" + resource + \", Maven runtime information not available\";\n            if (logger.isDebugEnabled()) {\n                logger.warn(msg, e);\n            } else {\n                logger.warn(msg);\n            }\n        }\n\n        String version = props.getProperty(\"version\", \"\").trim();\n\n        if (!version.startsWith(\"${\")) {\n            return version;\n        } else {\n            return \"\";\n        }\n    }","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java#L52-L88","documentation":"DefaultRuntimeInformation.loadMavenVersion() tried to open /META-INF/maven/org.apache.maven/maven-core/pom.properties from the classloader to read the running Maven version and getResourceAsStream returned null. The version ends up as an empty string, so RuntimeInformation.getMavenVersion() reports nothing and features that depend on it (e.g. enforcer's requireMavenVersion, maven-war/enforcer plugin metadata checks) degrade. The resource is generated by the maven-core build itself; it is present in every official distribution jar.","triggerScenarios":"Loading DefaultRuntimeInformation in a classloader that cannot see the maven-core jar's META-INF metadata: embedding Maven inside an application with an isolated/child-first classloader, a shaded or repackaged uber-jar that dropped META-INF/maven entries, or a hand-rolled Maven classpath assembled from loose classes.","commonSituations":"Custom launcher scripts that build the Maven classpath manually and exclude pom.properties; fat-jar bundling of maven-core with an aggressive META-INF filter; OSGi or container classloaders that hide META-INF/maven; corrupted maven-core jar in a partial download.","solutions":["Run builds with an official Maven distribution (apache-maven-x.y.z-bin.tar.gz) so maven-core ships its pom.properties","If shading/embedding, keep META-INF/maven/** resources: configure the shade/assembly filter to include them","Verify the jar is intact: unzip -l $M2_HOME/lib/maven-core-*.jar | grep pom.properties","In embedding code, do not depend on getMavenVersion() when it returns empty; fall back to a version you inject yourself"],"exampleFix":"<!-- before: shade filter strips META-INF and drops pom.properties -->\n<plugin>\n  <artifactId>maven-shade-plugin</artifactId>\n  <configuration>\n    <filters>\n      <filter>\n        <artifact>*:*</artifact>\n        <excludes>\n          <exclude>META-INF/**</exclude>\n        </excludes>\n      </filter>\n    </filters>\n  </configuration>\n</plugin>\n\n<!-- after: keep maven metadata, only strip signatures -->\n<plugin>\n  <artifactId>maven-shade-plugin</artifactId>\n  <configuration>\n    <filters>\n      <filter>\n        <artifact>*:*</artifact>\n        <excludes>\n          <exclude>META-INF/*.SF</exclude>\n          <exclude>META-INF/*.DSA</exclude>\n        </excludes>\n      </filter>\n    </filters>\n  </configuration>\n</plugin>","handlingStrategy":"fallback","validationCode":"// Embedding Maven: verify runtime info is available before relying on it\ntry (var is = DefaultRuntimeInformation.class\n        .getResourceAsStream(\"/META-INF/maven/org.apache.maven/maven-core/pom.properties\")) {\n    if (is == null) {\n        log.warn(\"maven-core metadata missing on classpath; falling back to injected version\");\n    }\n}\n// or simply probe the API:\nString v = runtimeInformation.getMavenVersion();\nif (v == null || v.isBlank()) v = System.getProperty(\"maven.version.default\", \"unknown\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Launch Maven from official distributions instead of hand-assembled classpaths","When shading or embedding maven-core, keep META-INF/maven/** in the filter configuration","Never parse getMavenVersion() blindly; check for empty string and degrade gracefully","Verify distribution integrity with checksums after download"],"tags":["maven","classpath","runtime-info","embedding"],"backgroundTag":"missing-classpath-resource","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}