Home  >  Article  >  Java  >  Native Image Quick Reference — GraalVM for JDK - graalvm

Native Image Quick Reference — GraalVM for JDK - graalvm

DDD
DDDOriginal
2024-11-15 02:36:02250browse

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

Native Image Quick Reference — GraalVM for JDK - graalvm

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

Quarkus (micro services)

https://code.quarkus.io/

Reference:

  • https://medium.com/graalvm/native-image-quick-reference-graalvm-for-jdk-23-45cb94b65bf7

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn