{"record":{"id":"be57176fd864880e","repo":"GoogleContainerTools/jib","slug":"message-from-incompatiblebaseimagejavaversionexce-be5717","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/BuildTarMojo.java","lineNumber":143,"sourceCode":"              + \"DateTimeFormatter.ISO_DATE_TIME) or special keyword \\\"EPOCH_PLUS_SECOND\\\": \"\n              + ex.getInvalidFilesModificationTime(),\n          ex);\n\n    } catch (InvalidCreationTimeException ex) {\n      throw new MojoExecutionException(\n          \"<container><creationTime> should be an ISO 8601 date-time (see \"\n              + \"DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\\\"EPOCH\\\", \"\n              + \"\\\"USE_CURRENT_TIMESTAMP\\\"): \"\n              + ex.getInvalidCreationTime(),\n          ex);\n\n    } catch (JibPluginExtensionException ex) {\n      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) {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildTarMojo.java#L125-L161","documentation":"Thrown as a MojoExecutionException from BuildTarMojo.execute when the project's Java major version is incompatible with the base image's Java version (IncompatibleBaseImageJavaVersionException). The message is produced by HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven and suggests a matching base image for your project's Java version.","triggerScenarios":"Building with <from><image> set to a Jib-provided base image (e.g. gcr.io/jib-runtime-image or distroless java) whose major Java version (e.g. 17) is lower than the project's compile target (e.g. maven.compiler.target=21).","commonSituations":"After upgrading the project to a newer JDK (e.g. 11 -> 17 or 17 -> 21) without updating the base image; using the default jib-runtime-style image pinned to an older Java.","solutions":["Update <from><image> to a base image matching or exceeding your project's Java version (the error text names the required version).","For Jib-provided images, switch to the variant for your major version, e.g. gcr.io/jib-runtime-image:21 or eclipse-temurin:21-jre.","Alternatively lower the project's Java version (maven.compiler.source/target or release flag) if it must match an older base image.","Check for a parent POM or profile pinning an old base image and update it there."],"exampleFix":"// before\n<from><image>gcr.io/jib-runtime-image:11</image></from>\n// after\n<from><image>gcr.io/jib-runtime-image:21</image></from>","handlingStrategy":"validation","validationCode":"// Verify project vs base image Java versions before building\nString target = project.getProperties().getProperty(\"maven.compiler.target\");\nString baseImageJava = \"17\"; // major version of the chosen base image\nif (Integer.parseInt(target) > Integer.parseInt(baseImageJava)) {\n  throw new IllegalStateException(\"Base image Java \" + baseImageJava + \" < project target \" + target);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Update <from><image> whenever bumping maven.compiler.source/target/release.","Prefer parameterized base image versions (property or profile) tied to the compiler target.","Read the error's suggestion text — it names a compatible base image.","Watch for parent POMs pinning an outdated base image."],"tags":["maven","jib","java-version","base-image"],"backgroundTag":"incompatible-base-image-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"}