Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify GRAALVM version in Maven #1188

Open
padetiloye opened this issue Aug 28, 2024 · 2 comments
Open

How to specify GRAALVM version in Maven #1188

padetiloye opened this issue Aug 28, 2024 · 2 comments

Comments

@padetiloye
Copy link

padetiloye commented Aug 28, 2024

Issue description

I need to use the graalvm version 22.2 in maven but I've no clue where to set it in the pom.xml.

https://www.graalvm.org/release-notes/22_2/

Is there a micronaut version that support graalvm version 22.2 yet ?

Any suggestion ?

@yawkat
Copy link
Member

yawkat commented Sep 2, 2024

You can just run the build using that version as your JAVA_HOME eg using sdkman

@padetiloye
Copy link
Author

@yawkat - it doesn't use your JAVA_HOME installation. The version of JVM used inside the docker container is different from local installation.

Changing the jdk.version in the pom file changes GRAALVM_JVM_VERSION to 22 but does not allow to build a native image with the error

 To build native images you must set the Java target byte code level to Java 21 or below

All attempt to change GRAALVM_JVM_VERSION variable didn't work and kept the jdk.version in the pom file.

[INFO] --- mn:4.6.1:docker-native (default-docker-native) @ game-stats ---
[INFO] Using GRAALVM_JVM_VERSION: 17
[INFO] Using GRAALVM_ARCH: x64
[INFO] Using CLASS_NAME: com.wba.tokenization.FunctionLambdaRuntime

The only walkaround for us is to build the native image using the customize Dockerfile generated by the plugin.

Generate a dockerfile from micronaut app

 mvn mn:dockerfile -Dpackaging=docker-native -Dmicronaut.runtime=lambda

and now, do

mvn package -Dpackaging=docker -Dmicronaut.runtime=lambda -Pgraalvm

This is cumbersome to just change the GRAALVM_JVM_VERSION

@graemerocher graemerocher transferred this issue from micronaut-projects/micronaut-core Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants