I've just upgraded several projects to Java 19, Spring Boot 3.0.2, Kotlin 1.8.0 with Maven and I'd like Spring Boot to generate native images.
<java.version>19</java.version>
<kotlin.version>1.8.0</kotlin.version>
The relevant part of the configuration of spring-boot-maven-plugin
is:
<configuration>
<image>
<env>
<BP_JVM_VERSION>19.*</BP_JVM_VERSION>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
<BPE_APPEND_JAVA_TOOL_OPTIONS>-XX:+HeapDumpOnOutOfMemoryError -XX:MaxDirectMemorySize=64M</BPE_APPEND_JAVA_TOOL_OPTIONS>
<BPE_DELIM_JAVA_TOOL_OPTIONS xml:space="preserve"> </BPE_DELIM_JAVA_TOOL_OPTIONS>
</env>
</image>
</configuration>
However, when I build one of the projects with
mvn -Pnative spring-boot:build-image
then the build fails with the following error message:
[INFO] [creator] Paketo Buildpack for BellSoft Liberica 9.10.2
[INFO] [creator] unable to find dependency
[INFO] [creator] no valid dependencies for native-image-svm, 19.*, and io.paketo.stacks.tiny in [(jdk, 8.0.362, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 8.0.362, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 11.0.18, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 11.0.18, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (native-image-svm, 11.0.17, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 17.0.6, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 17.0.6, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (native-image-svm, 17.0.5, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 19.0.2, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 19.0.2, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *])]
[INFO] [creator] ERROR: failed to build: exit status 1
What's missing?
Update: When I downgrade to Java 17 with Kotlin 1.7.21, then the build succeeds and apparently there's no support yet in the Liberica Native Image Kit for Java 19. https://bell-sw.com/pages/downloads/native-image-kit/#/nik-22-19