diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java index ac8ae9dee5..20e97ac3b1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java @@ -126,7 +126,8 @@ final class JavaPluginAction implements PluginApplicationAction { buildImage.setDescription("Builds an OCI image of the application using the output of the bootJar task"); buildImage.setGroup(BasePlugin.BUILD_GROUP); buildImage.getArchiveFile().set(bootJar.get().getArchiveFile()); - buildImage.getTargetJavaVersion().set(javaPluginConvention(project).getTargetCompatibility()); + buildImage.getTargetJavaVersion() + .set(project.provider(() -> javaPluginConvention(project).getTargetCompatibility())); }); }