Skip to content

Question: How to find a JDK runtime with master? #64

@jpsim

Description

@jpsim

I've been using rules_java 5.0.0 successfully, but I'll soon need to update to include recent changes in master to support the latest bazel 6.x rolling releases.

Prior to 338c418 the JDK runtime toolchain was being found correctly, but after that commit I get the following error:

ERROR: /.../BUILD:21:19: While resolving toolchains for target //{my-target}: no matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type
Here's the complete error
INFO: Repository remotejdk11_macos_aarch64 instantiated at:
  /Users/jsimard/src/envoy-mobile/WORKSPACE:58:26: in <toplevel>
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/envoy_mobile/bazel/envoy_mobile_dependencies.bzl:53:24: in envoy_mobile_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/envoy_mobile/bazel/envoy_mobile_dependencies.bzl:62:28: in kotlin_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_java/java/repositories.bzl:469:23: in rules_java_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_java/java/repositories.bzl:233:10: in remote_jdk11_repos
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_java/toolchains/remote_java_repository.bzl:48:17: in remote_java_repository
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
ERROR: /Users/jsimard/src/envoy-mobile/library/kotlin/io/envoyproxy/envoymobile/BUILD:21:19: While resolving toolchains for target //library/kotlin/io/envoyproxy/envoymobile:envoy_lib_kt: no matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type

I'm probably not specifying something I should be, or perhaps this is considered a bug? I'm not sure, so I'm phrasing this as a question.

To reproduce you can clone Envoy Mobile and run the following command:

./bazelw build android_dist --config=android --override_repository=rules_java=/path/to/rules_java

I'll work to reduce and simplify the repro case but I wanted to share now in case the solution was obvious to more experienced users or maintainers of rules_java.

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions