Skip to content

Latest commit

 

History

History
96 lines (81 loc) · 6.3 KB

README.md

File metadata and controls

96 lines (81 loc) · 6.3 KB

native-helper-maven-plugin

Maven plugin with helper methods for generating native configuration

Keep a Changelog v1.1.0 badge license
code of conduct Maven Central
Quality Gate Status
Coverage

Java runtime version Java build version Apache Maven Fugerit Github Project Conventions

This maven plugin allows generation of graalvm metadata using the native-helper-graalvm

1. mojo 'generate'

Write a native-helper-config.yaml configuration file for the project. (configuration reference here)

<plugin>
    <groupId>org.fugerit.java</groupId>
    <artifactId>native-helper-maven-plugin</artifactId>
    <version>${native-helper-maven-plugin-version}</version>
    <executions>
        <execution>
            <id>generate-native-configuration</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <createParentDirectory>true</createParentDirectory>
                <nativeHelperConfigPath>${project.basedir}/src/main/config/native-helper-config.yaml</nativeHelperConfigPath>
                <reflectConfigJsonOutputPath>${project.build.directory}/generated-resources/reflect-config-demo.json</reflectConfigJsonOutputPath>
                <warnOnError>false</warnOnError>
            </configuration>
        </execution>
    </executions>
</plugin>

mojo 'generate' configuration reference

name default required type description
nativeHelperConfigPath none true string Path to native-helper-config.yaml configuration file
reflectConfigJsonOutputPath none false string generation path for reflect-config.json file
createParentDirectory false false boolean if set to true will create reflectConfigJsonOutputPath parent folder
warnOnError false false boolean if set to true exception will be logged instead of generating a build error

2. mojo 'merge'

<plugin>
    <groupId>org.fugerit.java</groupId>
    <artifactId>native-helper-maven-plugin</artifactId>
    <version>${native-helper-maven-plugin-version}</version>
    <executions>
        <execution>
            <id>merge-native-configuration</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>merge</goal>
            </goals>
            <configuration>
                <reflectConfigJsonFiles>
                    <reflectConfigJsonFile>${project.build.directory}/generated-resources/reflect-config-demo.json</reflectConfigJsonFile>
                    <reflectConfigJsonFile>${project.basedir}/src/main/config/reflect-config-nhg.json</reflectConfigJsonFile>
                </reflectConfigJsonFiles>
                <reflectConfigJsonOutputPath>${project.build.outputDirectory}/META-INF/native-image/reflect-config.json</reflectConfigJsonOutputPath>
                <createParentDirectory>true</createParentDirectory>
                <warnOnError>true</warnOnError>
            </configuration>
        </execution>
    </executions>
</plugin>

mojo 'merge' configuration reference

name default required type description
reflectConfigJsonFiles.reflectConfigJsonFile none true string List of reflect-config.json files to merge
reflectConfigJsonOutputPath none true string generation path for reflect-config.json file
createParentDirectory false false boolean if set to true will create reflectConfigJsonOutputPath parent folder
warnOnError false false boolean if set to true exception will be logged instead of generating a build error

3. Demo project

Here is a simple demo project