Skip to content

Additional transformers for the Maven shade plugin dealing with GraalVM native image configuration files.

License

Notifications You must be signed in to change notification settings

michael-simons/native-image-config-transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

native-image-config-transformer

Introduction

Additional resource transformer for the Apache Maven Shade Plugin, that can transform JSON formatted configuration files for GraalVM native image.

They transformers are catered for bundling dependencies into "fat-jars" and are used with the bundled versions of the Neo4j JDBC drivers and work quite well for that purpose.

They are zero guarantees that they will work for you, too.

Things that will be transformed and relocated:

  • Type names in reflect-config.json (both the name and names in conditions)

  • Bundle names in resource-config.json

  • Type names in native-image.properties listed as --initialize-at-run-time or --initialize-at-build-time.

Installation

You must add native-image-config-transformer as additional dependency to the maven-shade-plugin and configure the included transformers like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.6.0</version>
    <dependencies>
        <dependency>
            <groupId>eu.michael-simons.maven</groupId>
            <artifactId>native-image-config-transformer</artifactId>
            <version>0.0.1</version>
        </dependency>
    </dependencies>
    <configuration>
        <transformers>
            <transformer implementation="ac.simons.maven.shade.NativeImagePropertiesTransformer" />
            <transformer implementation="ac.simons.maven.shade.ReflectConfigTransformer" />
        </transformers>
    </configuration>
</plugin>

If you source metadata from the GraalVM reachability repository, you can configure the native-maven-plugin to copy that metadata locally and adding it to your fat jar before the shade plugin is run, so that those resources are transformed, too:

Listing 1. Configure the native-maven-plugin to copy the reachability metadata
<plugin>
    <groupId>org.graalvm.buildtools</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>add-reachability-metadata</id>
            <goals>
                <goal>add-reachability-metadata</goal>
            </goals>
        </execution>
    </executions>
</plugin>

About

Additional transformers for the Maven shade plugin dealing with GraalVM native image configuration files.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 2

  •  
  •