This page details GraalVM native image.

Native compilation

To convert your application to a native binary - assuming your dependencies are native friendly like Fusion framework, you can use Apache Geronimo Arthur maven plugin.

Assuming you use this main for example:

package demo.fusion;

import io.yupiik.fusion.framework.api.ConfiguringContainer;
import io.yupiik.fusion.framework.api.lifecycle.Start;
import io.yupiik.fusion.framework.api.scope.ApplicationScoped;
import io.yupiik.fusion.framework.build.api.event.OnEvent;
import io.yupiik.fusion.framework.build.api.lifecycle.Init;

@ApplicationScoped
public class Greeter {
    @Init
    protected void init() {
        System.out.println("> Init");
    }

    public void onStart(@OnEvent final Start start) {
        System.out.println("> start: " + start);
    }

    public static void main(final String... args) {
        try (final var container = ConfiguringContainer.of().start()) {
            // no-op
        }
    }
}

You can just add this plugin:

<plugin>
  <groupId>org.apache.geronimo.arthur</groupId>
  <artifactId>arthur-maven-plugin</artifactId>
  <version>1.1.6</version>
  <configuration>
    <graalVersion>22.3.2</graalVersion>
    <main>demo.fusion.Greeter</main>
  </configuration>
</plugin>

And run mvn package arthur:native-image and you will get your binary in target/.

TIP

the exact arthur-maven-plugin and graalVersion to use depend on the GraalVM release you target - check the table in the arthur documentation for the pairing you need.

Native-image metadata

When native image generation is enabled (fusion.generateNativeImage, on by default), the Fusion annotation processor generates a META-INF/native-image/<group>/<artifact>/reachability-metadata.json globbing META-INF/fusion/**/*.json so the generated JSON metadata (configuration, JSON schemas, OpenRPC partials, generated CRDs) is reachable in the native binary. fusion-http-server additionally ships its own reachability metadata for its GraalVM-friendly Tomcat wiring.

If you write your own GraalVM reachability metadata, point the Arthur plugin (or native-image options) at your jar's META-INF/native-image directory so the generator and the plugin metadata are merged.

TIP
if you are a purist, and depending your needs and Arthur version you can need to add the following configuration to avoid warnings:
<enableAllSecurityServices>false</enableAllSecurityServices>
<allowIncompleteClasspath>false</allowIncompleteClasspath>
TIP

if you want a JUL implementation which is GraalVM friendly you can use yupiik Logging (yupiik-logging-jul dependency concretely which works smoothly with GraalVM and enables a runtime system property logging control) and configure it in Arthur Maven Plugin (or GraalVM native-image) using:

<customOptions>
  <customOption>-Djava.util.logging.manager=io.yupiik.logging.jul.YupiikLogManager</customOption>
</customOptions>