apache/maven · critical · InitializationException
Unable to read Maven version from maven-core
Error message
Unable to read Maven version from maven-core
What it means
DefaultRuntimeInformation.initialize() takes the version string from RuntimeInformation (parsed from maven-core's own resources) and turns it into the application version exposed to plugins. If that string is null or empty, initialization fails with InitializationException - Maven literally could not determine its own version. This points at a damaged, repackaged, or non-standard Maven installation rather than any project setting.
Source
Thrown at compat/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java:54
@Singleton
public class DefaultRuntimeInformation implements RuntimeInformation, Initializable {
@Inject
private org.apache.maven.rtinfo.RuntimeInformation rtInfo;
private ArtifactVersion applicationVersion;
@Override
public ArtifactVersion getApplicationVersion() {
return applicationVersion;
}
@Override
public void initialize() throws InitializationException {
String mavenVersion = rtInfo.getMavenVersion();
if (mavenVersion == null || mavenVersion.isEmpty()) {
throw new InitializationException("Unable to read Maven version from maven-core");
}
applicationVersion = new DefaultArtifactVersion(mavenVersion);
}
}
View on GitHub (pinned to e4093d4e12)
Solutions
- Replace the Maven installation with a fresh official distribution and verify mvn -v prints a version
- Inspect the maven-core jar: unzip -l $MAVEN_HOME/lib/maven-core-*.jar | grep pom.properties - it must contain META-INF/maven/org.apache.maven/maven-core/pom.properties; if not, it was repackaged, so restore the original jar
- In embedded setups, consume maven-core as the published artifact instead of a modified or shaded copy
- Rebuild the CI/Docker image from a clean base if the corruption came from image layering
Example fix
# before: broken distribution reports no version mvn -v # fails during startup with InitializationException # after: replace installation wholesale and verify tar -xzf apache-maven-3.9.x-bin.tar.gz -C /opt && export PATH=/opt/apache-maven-3.9.x/bin:$PATH mvn -v
Defensive patterns
Strategy: try-catch
Validate before calling
// verify the version resource exists before bootstrapping Maven
try (java.io.InputStream in = org.apache.maven.rtinfo.RuntimeInformation.class
.getClassLoader()
.getResourceAsStream("META-INF/maven/org.apache.maven/maven-core/pom.properties")) {
if (in == null) {
// broken maven-core on the classpath: repair before starting
}
} Try / catch
Catch InitializationException from the container initialize phase; if the message is 'Unable to read Maven version from maven-core', abort and repair the distribution - retrying against the same installation reproduces the failure.
Prevention
- Install Maven from official distributions; never hand-patch jars under MAVEN_HOME/lib.
- Pin the Maven distribution URL/version in CI images for reproducibility.
- Add a mvn -v smoke test to Dockerfiles immediately after installing Maven.
When it happens
Trigger: Booting a Maven distribution whose maven-core jar is missing its version resources (shaded, repackaged, or truncated download), or a custom launcher/embedded classpath that supplies maven-core classes without the META-INF properties that carry the version.
Common situations: Hand-patched or shaded maven-core jars; partial Maven upgrades mixing lib jars; IDE-bundled Maven broken by an IDE update; Docker images built by copying a half-extracted archive.
Related errors
- Unable to lookup org.eclipse.aether.RepositorySystem
- The super POM {resource} was not found, please verify the in
- The super POM {resource} is damaged, please verify the integ
- Cannot inline property {}
- Required Maven version {} is not met by current version {}
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/d50ef646bf5d2ea2.
Report an issue: GitHub.