What is the best way to include resources? Details in Thread...
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 withThe way I do it in bb: https://github.com/babashka/babashka/blob/b59bfcb7e64dd8dad142379b0f8cfddb04c84e90/resources/META-INF/native-image/babashka/babashka/native-image.properties#L5-L8
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?)
@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.