Skip to content

Latest rules_java and rules_android do not work with Bazel 7 #350

@shs96c

Description

@shs96c

In rules_jvm_external, we are attempting to bump the version of rules_android to 0.7.1 (which supports Bazel 9). This implicitly updates rules_java to version 9.3.0.

Something in this mix is causing this error when we try bazel test //... in the root of rules_jvm_external when using Bazel 7.7.1:

ERROR: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_shs/068e53caf10f6ae803d9aecfac741389/external/rules_java~/java/java_single_jar.bzl", line 89, column 23, in <toplevel>
                java_single_jar = rule(
Error in rule: file '@@rules_java~//java:java_single_jar.bzl' cannot use private API
ERROR: error loading package under directory '': error loading package 'private/tools/java/com/github/bazelbuild/rules_jvm_external/resolver/gradle/plugin': initialization of module 'java/java_single_jar.bzl' failed

This is either a problem in rules_java (likely, because the error message points to the java_single_jar rule) or perhaps rules_android.

To replicate:

git clone https://github.com/shs96c/rules_jvm_external.git
cd rules_jvm_external
git checkout update-deps
bazel build //...

The problem only occurs with Bazel 7.x. Builds appear to work just fine with Bazel 8.x and 9.

Our support policy for rules_jvm_external is LTS-2, so we would like to continue supporting Bazel 7 until Bazel 10 ships.

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions