DEV Community

özkan pakdil
özkan pakdil

Posted on

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

Image description

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:

Top comments (0)