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

Unnecessary eager check for GraalVM installation breaks builds when using other JDKs #327

Closed
alvarosanchez opened this issue Oct 5, 2022 · 3 comments · Fixed by #345
Closed
Assignees
Labels
bug Something isn't working maven-plugin Related to Maven plugin
Milestone

Comments

@alvarosanchez
Copy link
Collaborator

#274 introduced an unnecessary eager check for a GraalVM installation:

https://github.com/graalvm/native-build-tools/blob/master/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeExtension.java#L120-L124

This halts the build with the following exception:

[INFO] Caused by: org.apache.maven.plugin.MojoExecutionException: 'gu' tool wasn't found. This probably means that JDK at isn't a GraalVM distribution.
[INFO]     at org.graalvm.buildtools.Utils.getJavaHomeNativeImage (Utils.java:89)
[INFO]     at org.graalvm.buildtools.Utils.getNativeImage (Utils.java:121)
[INFO]     at org.graalvm.buildtools.maven.NativeExtension.afterProjectsRead (NativeExtension.java:121)

Because this is done so early in an extension, it breaks builds even if no NBT mojo is being invoked.

The check should only be done lazily right before the graalvmJava variable is needed

@snicoll
Copy link
Collaborator

snicoll commented Oct 19, 2022

A note that it should also be possible to invoke a Mojo of Native Build Tools that does not need GraalVM. add-reachability-metadata in particular.

@sdeleuze sdeleuze self-assigned this Oct 24, 2022
@sdeleuze
Copy link
Collaborator

I start working on this and will submit a PR.

sdeleuze added a commit to sdeleuze/native-build-tools that referenced this issue Oct 24, 2022
add-reachability-metadata goal can now be run with a regular JDK.

Closes graalvmgh-327
@sschuberth
Copy link

I just filed a similar issue on the Gradle build file level, see #350.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maven-plugin Related to Maven plugin
4 participants