micronaut-gradle-plugin icon indicating copy to clipboard operation
micronaut-gradle-plugin copied to clipboard

Allow configuring additional entries for native image classpath

Open dmurat opened this issue 5 years ago • 3 comments

It would be great to have the ability to configure additional entries for the native-image --class-path option.

For some reasons I ended up writing [programmatic registration] (https://www.graalvm.org/reference-manual/native-image/Reflection/) for Graal runtime reflection via org.graalvm.nativeimage.hosted.Feature interface, where implementation needs to use external dependency.

In this situation, I will like to have the ability to configure that dependency as compileOnly, but still be able to provide it as part of the classpath for the native-image tool. I guess something like an additional Gradle configuration like graalNativeImageDependencies would solve the problem if the plugin takes it into account during the generation of the native-image classpath.

The current workaround is to use the implementation configuration for that external dependency, which is not ideal, I think.

Tnx.

dmurat avatar Nov 27 '20 21:11 dmurat

This plugin is going to use, at some point, the official GraalVM native image plugin. This plugin offers an extension, NativeImageOptions which lets you add things on classpath. However, I think it's a good idea to have an additional configuration which is used to declare dependencies which are only required at image build time. Would you mind creating an issue on the official GraalVM plugin for this?

melix avatar Aug 24 '21 08:08 melix

Sure, here it is: https://github.com/graalvm/native-build-tools/issues/129

dmurat avatar Aug 27 '21 12:08 dmurat