bazelbuild / bazelbuild/rules_java

no such target '@@+toolchains+local_jdk//:runtime_toolchain_definition' on Windows when JAVA_HOME is set to mapped drive

未关闭
#339 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
P3 question
主要语言
Starlark
星标
103
派生
102
PR 合并指标
30 天内没有已合并 PR

描述

I set JAVA_HOME to a mapped network drive copy of JDK 21 on Windows.
This is with latest rules_java and all rules_java releases back to 8.5 (I stopped searching at that point)

```
set JAVA_HOME=t:\jdk\jdk21
Bazel build fails

D:\workdir\github\rules_java>bazel build //... --noincompatible_disallow_empty_glob
ERROR: Traceback (most recent call last):
File "D:/udu/b/4skhmsqa/external/+toolchains+local_jdk/BUILD.bazel", line 78, column 66, in
java = glob(["bin/java.exe", "bin/java"], allow_empty = True)[0],
Error: index out of range (index is 0, but sequence has 0 elements)
ERROR: D:/workdir/github/rules_java/toolchains/BUILD:285:14: While resolving toolchains for target //toolchains:platformclasspath (4e49fa3): invalid registered toolchain '@local_jdk//:runtime_toolchain_definition': no such target '@@+toolchains+local_jdk//:runtime_toolchain_definition': target 'runtime_toolchain_definition' not declared in package '' defined by D:/udu/b/4skhmsqa/external/+toolchains+local_jdk/BUILD.bazel
Use --verbose_failures to see the command lines of failed build steps.
ERROR: Analysis of target '//toolchains:platformclasspath' failed; build aborted
INFO: Elapsed time: 1.601s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
```

set JAVA_HOME to a local copy
```
xcopy /E t:\jdk\jdk21 d:\jdk\jdk21
set JAVA_HOME=d:\jdk\jdk21

Bazel build succeeds
```

贡献指南

打开贡献指南

调研方向

将 JAVA_HOME 设置为映射驱动器路径 t:\\jdk\\jdk21,重现问题,然后将第 78 行失败的外部 +toolchains+local_jdk/BUILD.bazel 与本地驱动器上成功的情况进行比较。检查第 285 行的 toolchains/BUILD 以及空的 glob 结果;使用映射驱动器上的 JDK 成功执行 Bazel build 且运行时工具链已注册,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
build-system
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。