framework and GraalVM (native-image)
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.0.5</version>
<configuration>
<graalVersion>22.3.0.r17</graalVersion>
<main>demo.fusion.Greeter</main>
</configuration>
</plugin>
And run mvn package arthur:native-image
and you will get your binary in target/
.
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>
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>