-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.19:compile-no-fork (build-native) #35505
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
Comments
That looks like a Graal bug to me. Please make sure you're using an up-to-date version of Graal. It's also worth upgrading to the latest Spring Boot 3.0.x release to pick up a recent version of the Native Maven plugin as well. If those upgrades do not help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue. |
I am using Graal 22.3.1 with Java 17. Switching to Spring Boot 3.0.4 immediately gave me following exception.
I will provide you with a Zip of built app shortly using Spring Boot 3.0.2. |
Spring Boot 3.0.6 is the latest release. Any sample should use that version please. |
Thanks for the sample. Unfortunately, it isn't minimal and we don't have the bandwidth to look through such a large amount of code and dependencies. Please reduce it to the bare minimum that's required to reproduce the problem. I also suspect that it won't build as it's using a repository ( |
No problem, but it's not so simple to achieve minimum reduction. I've tried this twice and the problem is when I start removing classes, even a few of them, the original error gets replaced with some other. And as you can imagine, it's equally impossible for me to know which classes or dependencies I need to remove and which to leave so the original error stays. |
Hi, I think this should be a better example. There is a regular (non Spring) class in there with the same code: PrettyPrintJSON. It works fine in native build. |
Thanks. Can you please provide a complete |
Sorry, I missed it. Attached. Thanks |
I don't get that error when running your project. Instead I get the error that AOT classes are missing, and that's because your project is missing those bits: <build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> After adding them, I get this error:
That's because your application is mixing the polyglot features from GraalVM (in All the stacktraces you've provided show different problems. This seems to have a problem with Validation where in your attached project there's no sign of validation. So if you think there's a bug in Spring Boot, please upload a minimal sample of the application which triggers the validation error. |
I build this code in two steps. First I run mvn clean package and create a jar with all dependencies, then I run native-image --language:js -jar ./target/"jar with all dependencies".jar. Passing --language:js to native-image resolves "polyglot" issue. GraalVM allows mixing Java and other languages in one codebase. You will also need to install JavaScript support for GraalVM with following command $GRAALVM/bin/gu install js If you want to invoke native-image from POM (as have shown above) and handle this situation you need to add "--language:js" directive to "buildArgs" tag in plugin's configuration. I do have this version of build and it gives the same exception I've given. It's when running native-image command, I provided, I am getting this exception. I have nothing more to subtract from this code as it only has two classes. I do want to keep GraalVM "polyglot" dependencies and small amount of code to make sure it works with Spring in native build. One is simple Java class with "polyglot" code, which I am able to successfully build following steps in first paragraph. I can build and successfully run executables on Windows and Linux with this class. Then I added second class, which is annotated as Spring application, for which I had to add to POM Spring parent and one web dependency, since I am planning to use this code in Web app - two more additions in total. Once I made this change and regenerated native directory under META-INF using GraalVM agent, native-image command started throwing original exception I provided. I suspect, after some trial and error approach, it has something to do with content in resource-config.json related to what was generated to it by agent after adding Spring dependencies and code. Note: If you want to use my approach and be able to execute the code, you will need to change "mainClass" tag inside assembly plugin to point to regular PrettyPrintJSON class instead of Spring - based one. |
Duplicates oracle/graal#4473. |
Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.24:test (test-native) |
I am trying to compile natively Spring Boot (version 3.0.2) application, which I am able to run successfully in JVM. The build fails on the following step
[4/7] Parsing methods...
with following stack trace. I am also attaching POM file I used. Before building this app I ran it with GraalVM agent and generated config files.pom.zip
The text was updated successfully, but these errors were encountered: