javaquarkus

How to include classpath resources in a Quarkus native image?


It seems that by default the native image generated by Quarkus does not include any classpath resources corresponding to stuff from src/main/resources/.

From the GraalVM docs, I sort of understand why this happens, but now I'm stuck. Is there a way to configure the quarkus-maven-plugin to include the resources in the native image?


Solution

  • We have a layer to do that programmatically in extensions but, right now, we don't have any user facing API for applications.

    So for the time being, you could use this option of the quarkus-maven-plugin:

     <quarkus.native.additional-build-args>-H:ResourceConfigurationFiles=resources-config.json</quarkus.native.additional-build-args>
    

    Or you can also define it in your application.properties:

    quarkus.native.additional-build-args =-H:ResourceConfigurationFiles=resources-config.json
    

    Everything is documented here: https://quarkus.io/guides/writing-native-applications-tips .