0

I'm trying spring native with a small boot project which depends on opensaml, there are two config files inside the opensaml jar, opensaml jar

and the lib loads the config file by

Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)

the native image failed to start due to missing the resource, then I searched some posts and added

<buildArgs>
    <arg>-H:IncludeResources=".*"</arg>
</buildArgs>

in native-maven-plugin's configuration, but still failed to load the resource.

any advice? thanks a lot.

geeinhub
  • 25
  • 4

1 Answers1

1

Graalvm provides native image agent, after building the jar of the project just run with agent which will generate all required configuration

java -agentlib:native-image-agent=config-output-dir=./graalcnf/ -jar target/demo-jar-with-dependencies.jar

Here is a working example config for ktor. And here is how agent generated resource configuration.

Also spring documentation says

If you find a library which doesn’t work with GraalVM, please raise an issue on the reachability metadata project.

You may need to open ticket at https://github.com/oracle/graalvm-reachability-metadata

ozkanpakdil
  • 3,199
  • 31
  • 48