I am trying to build a Spring Boot application by using Eclipse + Maven + GraalVM on Windows and I am getting the following stackTrace:
[es.datik.graal_spring_proba.main.main:11756] setup: 1,832.97 ms, 1.51 GB
Error: Default native-compiler executable 'cl.exe' not found via environment variable PATH
Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
com.oracle.svm.core.util.UserError$UserException: Default native-compiler executable 'cl.exe' not found via environment variable PATH
To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
at com.oracle.svm.core.util.UserError.abort(UserError.java:139)
at com.oracle.svm.hosted.c.codegen.CCompilerInvoker.addSkipCheckingInfo(CCompilerInvoker.java:105)
at com.oracle.svm.hosted.c.codegen.CCompilerInvoker.<init>(CCompilerInvoker.java:73)
at com.oracle.svm.hosted.c.codegen.CCompilerInvoker$WindowsCCompilerInvoker.<init>(CCompilerInvoker.java:111)
at com.oracle.svm.hosted.c.codegen.CCompilerInvoker.create(CCompilerInvoker.java:85)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:869)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:556)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:471)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
I followed the steps included in the spring site documentation. However I was not able to reproduce it and build my app. The sequence was:
- Download "GraalVM-CE-java8-20.3.0" and unzip in my local computer.
- Add GraalVM to Eclipse: Window -> Preferences -> Java -> Installed JREs -> Add -> Select unzipped GraalVM folder
- My POM.xlm is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>es.datik</groupId>
<artifactId>graal_spring_proba</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-graalvm-native</artifactId>
<version>0.8.3</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>20.3.0</version>
<configuration>
<mainClass>es.datik.graal_spring_proba.main.Main</mainClass>
<buildArgs>
-Dspring.native.remove-yaml-support=true
-Dspring.spel.ignore=true
</buildArgs>
</configuration>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
- Configure "Run Configurations" to build the project:
- Main/Goals: -Pnative clean package
- JRE/Alternate JRE: graalvm-ce-java8-20.3.0
Main class does nothing special. Just follows the official GraalVM "CountUppercase" example.
GraalVM official doc informs about prerequisites on Windows: MSVC 2010 SP1 for JDK 8. In addition, I found this thread on StackOverflow with the same response.
I checked my installed packages and I found that I already had that installed. However I attempted to download it from the Microsoft site. When executing "vcredist_x64.exe", the system detected the package as installed, because it offered me to repair the installation if needed.
Has someone succesfully build a Spring Boot application with Eclipse + Maven + GraalVM on Windows?
You can find my setup below:
- Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz 3.31GHz
- 12 GB RAM
- Windows 10 Pro (x64)
- Eclipse Neon.3 Release (4.6.3)
- Maven runtime Eclipse-embedded (3.3.9)
- GraalVM-CE-java8-20.3.0
Could you please give me some tips about where am I failing?