Adding below to your pom xml and
<profile> <id>native</id> <build> <plugins> <plugin> <groupId>org.graalvm.buildtools</groupId> <artifactId>native-maven-plugin</artifactId> <version>${buildtools.version}</version> <executions> <execution> <id>build-native</id> <goals> <goal>compile-no-fork</goal> </goals> <phase>package</phase> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>
run command ./mvnw -Pnative package
Below you can see nice starters for different type of native binary graalvm supported projects.
https://start.gluon.io/
https://start.spring.io/#!type=maven-project&language=java&platformVersion=3.3.5&packaging=jar&jvmVersion=21&groupId=com.example&artifactId=demo&name=demo&description=Demo project for Spring Boot&packageName=com.example.demo&dependencies=native
https://code.quarkus.io/
Reference:
The above is the detailed content of Native Image Quick Reference — GraalVM for JDK - graalvm. For more information, please follow other related articles on the PHP Chinese website!