The Native Build Tools project provides extensive native-image support for a variety of different use cases. However, not all projects use Gradle or Maven as their build system. Below is a list of requirements of what needs to be done to achieve a certain goal in those build systems.

Collect Conditional Metadata For Libraries

Conditional metadata can be generated by inserting the Native Image Agent options into the command line of the JVM that runs the tests. To enable the agent, add the following to the command line:


When the JVM exists, the agent will output metadata with additional information into the metadata/{jvm-pid} directory. The output directory in the above command line depends on the pid of the running JVM. This is especially useful when the build tool runs multiple JVMs concurrently.

To produce conditional metadata, use the native-image-configure tool and pass the agent output directories:

native-image-configure generate-conditional –user-code-filter=filter.json –input-dir=<agent-output-dir> –input-dir=<agent-output-dir-2>... –output-dir=final-metadata/

The --user-code-filter argument has the same meaning as the code filter specified in the Gradle plugin documentation.

Using Common Native Build Tools Modules In A Build Tool Extension

For build tool extensions written in Java, you can use the common modules implemented in Native Build Tools.

These modules are able to:

  • Generate the JVM command line option for enabling the agent in different modes

  • Query and retrieve metadata from the reachability metadata repository