{"record":{"id":"eec835fcd75c938a","repo":"GoogleContainerTools/jib","slug":"message-from-incompatiblebaseimagejavaversionexce","errorCode":null,"errorMessage":"<message from IncompatibleBaseImageJavaVersionException via HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven>","messagePattern":"<message from IncompatibleBaseImageJavaVersionException via HelpfulSuggestions\\.forIncompatibleBaseImageJavaVersionForMaven>","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildDockerMojo.java","lineNumber":164,"sourceCode":"      String extensionName = ex.getExtensionClass().getName();\n      throw new MojoExecutionException(\n          \"error running extension '\" + extensionName + \"': \" + ex.getMessage(), ex);\n\n    } catch (IncompatibleBaseImageJavaVersionException ex) {\n      throw new MojoExecutionException(\n          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(\n              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),\n          ex);\n\n    } catch (InvalidImageReferenceException ex) {\n      throw new MojoExecutionException(\n          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);\n\n    } catch (IOException\n        | CacheDirectoryCreationException\n        | MainClassInferenceException\n        | InvalidGlobalConfigException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex);\n\n    } catch (BuildStepsExecutionException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex.getCause());\n\n    } catch (ExtraDirectoryNotFoundException ex) {\n      throw new MojoExecutionException(\n          \"<extraDirectories><paths> contain \\\"from\\\" directory that doesn't exist locally: \"\n              + ex.getPath(),\n          ex);\n    } finally {\n      tempDirectoryProvider.close();\n      MojoCommon.finishUpdateChecker(projectProperties, updateCheckFuture);\n      projectProperties.waitForLoggingThread();\n      getLog().info(\"\");\n    }\n  }\n}\n","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildDockerMojo.java#L146-L182","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"<!-- before: Java 8 project -->\n<from><image>gcr.io/distroless/java17-debian12</image></from>\n<!-- after -->\n<from><image>gcr.io/distroless/java8-debian12</image></from>","handlingStrategy":"validation","validationCode":"int projectJava = Integer.parseInt(System.getProperty(\"java.specification.version\", \"8\"));\nString baseImage = pomBaseImage; // e.g. gcr.io/distroless/java17-debian12\nif (baseImage.matches(\".*java(1[1-9]|[2-9][0-9]).*\") && projectJava < parseMajor(baseImage)) {\n  throw new IllegalStateException(\"Base image Java version exceeds project Java version\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["maven","jib","java-version","base-image"],"backgroundTag":"incompatible-java-version","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}