-
Notifications
You must be signed in to change notification settings - Fork 51
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
Gradle plugin nativeCompile fails when JAVA_HOME and GRAALVM_HOME are not set #542
Labels
bug
Something isn't working
Comments
Interesting. I actually didn't even expect Gradle to run if |
This is the workaround I've been using: graalvmNative {
binaries {
all {
// native-build-tools reads this to find native-image unless either JAVA_HOME or GRAALVM_HOME are set:
// https://github.com/graalvm/native-build-tools/blob/0.9.28/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/tasks/BuildNativeImageTask.java#L211
// https://github.com/graalvm/native-build-tools/blob/0.9.28/native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/internal/NativeImageExecutableLocator.java#L89
// https://github.com/graalvm/native-build-tools/issues/542
javaLauncher.set(javaToolchains.launcherFor {
// Compile with native-image from GraalVM for JDK21
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.GRAAL_VM)
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Gradle plugin nativeCompile fails when
JAVA_HOME
andGRAALVM_HOME
are not set.The documentation says:
But if I try a build with
~/.sdkman/candidates/java/21.0.1-graalce/bin/java
andnative-image
in the same directory (~/.sdkman/candidates/java/21.0.1-graalce/bin/native-image
), I get the following error:This does not happen when
JAVA_HOME
orGRAALVM_HOME
is set.To Reproduce
I used the following commands to reproduce:
excerpt from my subproject
build.gradle
:gradle.properties contains:
Expected behavior
The
nativeCompile
task to complete successfully, as it does whenJAVA_HOME
orGRAALVM_HOME
is set.Logs
See above. I'm happy to provide more info if necessary.
System Info:
io.micronaut.application
, see above)Additional context
I actually discovered the bug while trying to create a build that will run in a Nix shell environment.
I don't think either of these issues (or my workaround for them) is relevant:
But I thought I should link them for completeness.
The text was updated successfully, but these errors were encountered: