rules_java icon indicating copy to clipboard operation
rules_java copied to clipboard

Problem in version 6.5.0: no such target '@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type'

Open sfc-gh-kleonhard opened this issue 2 years ago • 7 comments

When upgrading from 6.4.0 to 6.5.0 I noticed this failure:

ERROR: <snip>/external/remotejdk11_linux_toolchain_config_repo/BUILD.bazel:27:10: no such target 
'@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type': 
target 'bootstrap_runtime_toolchain_type' not declared in package 'tools/jdk' defined by 
<snip>/external/bazel_tools/tools/jdk/BUILD (Tip: use `query "@bazel_tools//tools/jdk:*"` to see all the targets in that package) 
and referenced by '@remotejdk11_linux_toolchain_config_repo//:bootstrap_runtime_toolchain'

ERROR: <snip>/external/bazel_tools/src/tools/launcher/BUILD:9:14: While resolving toolchains for target @bazel_tools//src/tools/launcher:launcher: 
invalid registered toolchain '@remotejdk11_linux_toolchain_config_repo//:bootstrap_runtime_toolchain': 
Analysis failed

sfc-gh-kleonhard avatar Aug 17 '23 20:08 sfc-gh-kleonhard

Ping! The issue persists in 6.5.1 too

sfc-gh-kleonhard avatar Sep 01 '23 20:09 sfc-gh-kleonhard

https://github.com/bazelbuild/rules_java/pull/113 is the only commit that looks sus. @fmeum FYI in case it's something obvious.

sfc-gh-kleonhard avatar Sep 01 '23 20:09 sfc-gh-kleonhard

rules_java 6.5.0 requires Bazel 6.4.0 (not yet released) or a recent rolling release.

fmeum avatar Sep 01 '23 21:09 fmeum

Sorry about the breakage. With the benefit of hindsight, 6.5.0 should have been released as 7.0.0 but we didn't foresee this. I'm going to leave this open to make it easier to find for anyone else that runs into this. This should become a non-issue with Bazel 7.0

cc @keertk : we should probably bump the rules_java major version next time we make a release.

hvadehra avatar Sep 13 '23 08:09 hvadehra

Do you know what is the resolution for this? I have the same issue but I don't understand how to solve it 😅 I use the latest version of the rules_java and my bazel version is bazel 7.1.1. Do you need to specify a toolchain or something to avoid this error?

spaghettifunk avatar Apr 15 '24 13:04 spaghettifunk

@spaghettifunk Are you loading rules_java at the very top of your WORKSPACE? It's possible that some other dep pulls in an older version.

fmeum avatar Apr 15 '24 14:04 fmeum

That worked indeed 😄 Thank you very much for the help!

spaghettifunk avatar Apr 16 '24 09:04 spaghettifunk