GoogleContainerTools/jib · error · MojoExecutionException
<message from IncompatibleBaseImageJavaVersionException via
Error message
<message from IncompatibleBaseImageJavaVersionException via HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven>
What it means
Jib determined that the base image's Java version is incompatible with the project's Java version — typically a Java 8 project using a Java 11+ (or 17+) base image like 'eclipse-temurin:17' with class files that cannot run there. IncompatibleBaseImageJavaVersionException is converted by BuildDockerMojo.execute() into a MojoExecutionException via HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven, which suggests a matching base image.
Source
Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildDockerMojo.java:164
String extensionName = ex.getExtensionClass().getName();
throw new MojoExecutionException(
"error running extension '" + extensionName + "': " + ex.getMessage(), ex);
} catch (IncompatibleBaseImageJavaVersionException ex) {
throw new MojoExecutionException(
HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(
ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),
ex);
} catch (InvalidImageReferenceException ex) {
throw new MojoExecutionException(
HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);
} catch (IOException
| CacheDirectoryCreationException
| MainClassInferenceException
| InvalidGlobalConfigException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
} catch (BuildStepsExecutionException ex) {
throw new MojoExecutionException(ex.getMessage(), ex.getCause());
} catch (ExtraDirectoryNotFoundException ex) {
throw new MojoExecutionException(
"<extraDirectories><paths> contain \"from\" directory that doesn't exist locally: "
+ ex.getPath(),
ex);
} finally {
tempDirectoryProvider.close();
MojoCommon.finishUpdateChecker(projectProperties, updateCheckFuture);
projectProperties.waitForLoggingThread();
getLog().info("");
}
}
}
View on GitHub (pinned to fb949e2676)
Solutions
- Align the base image with the project's Java version, e.g. use gcr.io/distroless/java:8 (or eclipse-temurin:8) for a Java 8 project.
- Alternatively raise the project's Java version (maven.compiler.release) to match the base image if the code is compatible.
- Follow the suggestion printed in the error, which names the base image major version and your project's major version.
- Pin maven.compiler.source/target/release explicitly so CI cannot silently change the Java level and desynchronize it from the base image.
Example fix
<!-- before: Java 8 project --> <from><image>gcr.io/distroless/java17-debian12</image></from> <!-- after --> <from><image>gcr.io/distroless/java8-debian12</image></from>
Defensive patterns
Strategy: validation
Validate before calling
int projectJava = Integer.parseInt(System.getProperty("java.specification.version", "8"));
String baseImage = pomBaseImage; // e.g. gcr.io/distroless/java17-debian12
if (baseImage.matches(".*java(1[1-9]|[2-9][0-9]).*") && projectJava < parseMajor(baseImage)) {
throw new IllegalStateException("Base image Java version exceeds project Java version");
} Prevention
- Keep the base image's Java major version >= the project's maven.compiler.release.
- Pair compiler settings and <from><image> in the same parent pom or a shared property.
- Read the HelpfulSuggestions output in the error — it names both versions explicitly.
When it happens
Trigger: Running a jib goal when the project compiles with target/release Java 8 (maven.compiler.target=8) but <from><image> points to a JRE/JDK base image for Java 11, 17, or 21 (e.g. gcr.io/distroless/java17-debian12).
Common situations: Upgrading the base image to a newer distroless tag without changing the project's compile target; copying an example pom built for Java 17 into a Java 8 project; CI overriding compiler properties while the pom's base image stays new.
Related errors
- <message from IncompatibleBaseImageJavaVersionException via
- <message from IncompatibleBaseImageJavaVersionException via
- The input JAR (${jarPath}) is compiled with Java ${jarJavaVe
- Your project is using Java ${projectMajorJavaVersion} but th
- HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForGra
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/eec835fcd75c938a.
Report an issue: GitHub.