micronaut-maven-plugin
micronaut-maven-plugin copied to clipboard
Override Graalvm JVM version
How do I specify the graalvm version used in the docker image? I do not see anyway this could be done in the documentation.
If we run the command to build the native-image, it's shows the version as GRAALVM_JVM_VERSION as 21 but I would like to use the Graalvm JVM version 22.
./mvnw package -Dpackaging=docker-native -Dmicronaut.runtime=lambda -Pgraalvm
Output
[INFO]
[INFO] --- mn:4.6.1:docker-native (default-docker-native) @ default ---
[INFO] Using GRAALVM_JVM_VERSION: 21
[INFO] Using GRAALVM_ARCH: x64
[INFO] Using CLASS_NAME: io.micronaut.function.aws.runtime.MicronautLambdaRuntime
Reason for the upgrade
We noticed GRAALVM_JVM_VERSION 21 throws the following error while building the native image but GRAALVM_JVM_VERSION 22 doesn't.
[INFO] com.oracle.svm.core.util.UserError$UserException: The class java.util.Random has already been initialized (from 'META-INF/native-image/native-image.properties' in 'file:///home/app/classes/' with 'java.util.Random'); it is too late to register java.util.Random for build-time initialization. java.util.Random caused initialization of this class with the following trace:
at java.util.Random.<clinit>(Random.java:336)
at java.util.concurrent.ForkJoinPool.submissionQueue(ForkJoinPool.java:2324)
at java.util.concurrent.ForkJoinPool.poolSubmit(ForkJoinPool.java:2368)
at java.util.concurrent.ForkJoinPool.execute(ForkJoinPool.java:2847)
at com.oracle.svm.hosted.ImageClassLoader$1.execute(ImageClassLoader.java:93)
at com.oracle.svm.hosted.NativeImageClassLoaderSupport$LoadClassHandler.lambda$initModule$2(NativeImageClassLoaderSupport.java:647)
at com.oracle.svm.hosted.NativeImageClassLoaderSupport$LoadClassHandler$$Lambda/0x00000007c02df1c0.accept(Unknown Source)
at jdk.internal.module.SystemModuleFinders$ModuleContentSpliterator.tryAdvance(SystemModuleFinders.java:573)
at java.util.Spliterator.forEachRemaining(Spliterator.java:332)
Any suggestion ?