Bazel 5 : java_library
no longer has resource_jars
attribute
#14374
Labels
P4
This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Rules-Java
Issues for Java rules
type: support / not a bug (process)
Description of the problem / feature request:
In previous versions of Bazel, the
java_library
rule had aresource_jars
attribute with allowed adding resource files into the constructed jar. This feature is due to be removed in Bazel 6, and is disabled by default in Bazel 5. However there is no way to enable the use of theresource_jars
attribute in Bazel 5rc2Feature requests: what underlying problem are you trying to solve with this feature?
Our older rules still use
java_library
with theresource_jars
attribute. Migration to the new version requires updating the rules using this attribute and, in some cases, modifying other rules as well. We were hoping that the transition to Bazel 5 could be completed before having to re-write many rules in our build system.Simply replacing the
resource_jars
with theruntime_deps
(ordeps
) to add the files into the final jar is the rule producing the dependency must return aJavaInfo
. So in some cases the rule collecting the files didn't need to be Java specific. But now it does.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
WORKSPACE:
BUILD.bazel
% bazel build --incompatible_disallow_resource_jars=false //...
INFO: Invocation ID: 9073985b-f840-48d3-a69c-41c0ead0ebad
ERROR: /Users/tjoneslo/Documents/workspace/apple_federation/tests/resource_jars/BUILD.bazel:2:13: //:test_jar: no such attribute 'resource_jars' in 'java_library' rule
ERROR: error loading package '': Package '' contains errors
What's the output of
bazel info release
?% bazel info release
release 5.0.0rc2
The text was updated successfully, but these errors were encountered: