graalvm

2024-10-31T17:16:54.839369Z

What is the best way to include resources? Details in Thread...

2024-10-31T17:17:27.608589Z

For example i need resources/my-lib.config.edn , resources/my-lib.schema.edn , and test/resources/config.edn with all .edn files in folder test/resources/schema and it's subfolders if test/resources folder is available. Docs say I need resources/META-INF/my-group/my-lib/reachability-metadata.json file and I tried like this:

{ "resources": [
    { "glob": "schema/**/*.edn"},
    { "glob": "my-lib.*.edn" } 
  ]
}
But native image in runtime see nothing. Another approach is to use the flag in preferences (by the way, where to read log about registered resources?):
(defproject ...

  :plugins [[io.taylorwood/lein-native-image "0.3.1"]]
  :native-image {:opts [...
                       "-H:ResourceConfigurationFiles=resource-config.json"
                       "-H:Log=registerResource:verbose"
                       ...] 
with such resource-config.json in project root:
{ "resources": {
    "includes": [
      { "pattern": ".*\\.edn$" }
    ]
  }
}
But this approach do not see files in test/resources folder regardless of :resource-paths of profile native-image alias called with

2024-10-31T17:20:07.261869Z

instead of resources/../reachability-metadata.json try resources/../resource-config.json you're right the doc says use reachability-metadata.json here https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resource-metadata-in-json but I'm using resource-config.json (maybe mine is a legacy holdover?)

2024-11-02T20:09:15.894779Z

@borkdude Yes, this approach only works. Annoying thing is that in GraalVM docs they say one thing, build process messages advice another one, but works finally the third.