Open ZY945 opened 1 year ago
The scenario in which the problem occurs
Upgrade the Spring project's jar first, and then try native-image to generate the exe file
mvn package native-image -jar .\Graalvm-SpringBoot-Demo-0.0.1-SNAPSHOT.jar --no-fallback
You will notice that the exe file appears, but the execution fails
spring doc:https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html You can do this successfully with Spring's plugin
<build> <plugins> <plugin> <groupId>org.graalvm.buildtools</groupId> <artifactId>native-maven-plugin</artifactId> <configuration> <!-- imageName用于设置生成的二进制文件名称 --> <imageName>${project.artifactId}</imageName> <!-- mainClass用于指定main方法类路径 --> <mainClass>${main-class}</mainClass> </configuration> <executions> <execution> <id>build-native</id> <goals> <goal>compile-no-fork</goal> </goals> <phase>package</phase> </execution> </executions> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> </excludes> </configuration> </plugin> </plugins> </build>
mvn clean package -Pnative
This issue is used to help people with the same problem later to solve it temporarily
Thank you for sharing this workaround, it is very helpful of you
Describe the issue
This issue is a workaround to summarize the problem. If your question is as follows
The scenario in which the problem occurs
Scene reproduction
You will notice that the exe file appears, but the execution fails
The way of solve
spring doc:https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html You can do this successfully with Spring's plugin