8

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?

Guillaume Smet
  • 9,921
  • 22
  • 29
Harald Wellmann
  • 12,615
  • 4
  • 41
  • 63

1 Answers1

11

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 .

Guillaume Smet
  • 9,921
  • 22
  • 29
  • 2
    Thanks, I've got it working now. I got confused by the single quotes from the GraalVM docs at first. So in the POM, you use `-H:IncludeResources=.*\.json`, but for a shell command, you would use `-H:IncludeResources='.*\.json'` – Harald Wellmann Mar 22 '19 at 14:52
  • 1
    FYI, this way of adding build args does not work any more. Now it seems to be done via `mvn quarkus:native-image -Dquarkus.native.additional-build-args=-H:+PrintAnalysisCallTree` – Galder Zamarreño Jan 21 '20 at 12:35