Skip to content

Native KBean

Creates native executables.

A native images is an executable file created from Java bytecode. This KBean allows to create native images from executable jars generated from the project.

This KBean exposes the following fields:

Field Description
args [String] Extra arguments to pass to native-image compiler.
staticLink [enum:JkNativeCompilation$StaticLink] Tell if the generated executable must by statically linked with native libs.
useMetadataRepo [boolean] Use predefined exploratory aot metadata defined in standard repo.
metadataRepoVersion [String] Use predefined exploratory aot metadata defined in standard repo.
includeMainClassArg [boolean] If false, the main class won't be specified in command line arguments. This means that it is expected to be mentioned in aot config files.
includeAllResources [boolean] If true, all resources will be included in the native image.

This KBean exposes the following methods:

Method Description
compile Creates a native image from the project's main artifact jar.
Builds the artifact first if none exists.

NativeKBean enables native compilation for project and base KBeans.

Key Features

  • Compiles classes into native executables.
  • Automatically applies AOT metadata.
  • Simplifies resource inclusion.
  • Handles static linkage with minimal configuration.

Example of Configuration in jeka.properties:

@native.includeAllResources=true
@native.staticLink=MUSL
@native.metadataRepoVersion=0.10.3

Invocation: jeka native: compile

See native API.