Hi,
Bazel 5 dropped support for `resource_jars` on `java_library`. It's no longer possible to let Bazel package resources automatically in the jar. I came up with a possible alternative using `rules_pkg` to generate a jar and `java_import` to make it available as runtime dependency.
The problem I face is that this doesn't seem to work as expected. I do see the resources getting packaged properly. But the `java_binary` seems to be incapable of locating the resources.
An example change can be observed here:
To reproduce:
cd bazel-java-builder-template/examples/001-simple
bazel build :all
The produced java_binary is execute in a rule like this:
ctx.actions.run(
..
executable = ctx.executable._mybuilder,
...
)
I can see the resource jars added to the run files manifest. However, if I look into the generated launcher script, I do not see the resource jar being added there to the CLASSPATH variable.
Is there anything else necessary to add the resource jar to the runtime deps?
-Gunnar