Native Image Quick Reference — GraalVM for JDK 23 – graalvm

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>

Enter fullscreen mode Exit fullscreen mode

run command ./mvnw -Pnative package

Below you can see nice starters for different type of native binary graalvm supported projects.

JavaFX (GUI)

https://start.gluon.io/

Spring (microservices or everything)

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%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=native

Quarkus (micro services)

https://code.quarkus.io/

Reference:

原文链接:Native Image Quick Reference — GraalVM for JDK 23 – graalvm

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容