Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bazel CI] Build failed due to missing target 'java_stub_template.txt' not declared in package 'tools/java' #328

Closed
sgowroji opened this issue Jan 21, 2025 · 4 comments

Comments

@sgowroji
Copy link
Member

sgowroji commented Jan 21, 2025

CI: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/4411#01948714-26fd-4e54-ab9f-fb4c0ea9d5e0

Platform: Ubuntu

Logs:

ERROR: �[0m/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/5f3a3e2fde2994b25bbcbe370cb970c4/external/bazel_tools/tools/java/BUILD: no such target '@@bazel_tools//tools/java:java_stub_template.txt': target 'java_stub_template.txt' not declared in package 'tools/java' defined by /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/5f3a3e2fde2994b25bbcbe370cb970c4/external/bazel_tools/tools/java/BUILD
ERROR: �[0m/var/lib/buildkite-agent/builds/bk-docker-cnwc/bazel-org-repo-root/rules_android/toolchains/android/BUILD:22:18: every rule of type android_toolchain implicitly depends upon the target '@@bazel_tools//tools/java:java_stub_template.txt', but this target could not be found because of: no such target '@@bazel_tools//tools/java:java_stub_template.txt': target 'java_stub_template.txt' not declared in package 'tools/java' defined by /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/5f3a3e2fde2994b25bbcbe370cb970c4/external/bazel_tools/tools/java/BUILD
ERROR: �[0mAnalysis of target '//toolchains/android:android_default' failed; build aborted: Analysis failed

Steps:

git clone https://github.com/bazelbuild/rules_android
git reset 8954fe9cc3974d79824a466c45b915de178a82ac  --hard
export USE_BAZEL_VERSION=b704fdb18b8201ddfc017ab91b9d0a63892a4cd2
bazel build   --enable_bzlmod=false --enable_workspace=true --java_runtime_version=17  //android/... //src/... -//src/java/com/example/sampleapp/... //test/... -//test/rules/... //toolchains/... //tools/... -//tools/android/... 

CC Greenteam @fweikert

@sgowroji
Copy link
Member Author

CC @ted-xie @ahumesky

meteorcloudy pushed a commit to bazelbuild/continuous-integration that referenced this issue Jan 23, 2025
Disabling rules_android and rules_android_ndk as there is no much
response and failures are seeing in the downstream from long period.

rules_android
bazelbuild/rules_android#261
bazelbuild/rules_android#266
bazelbuild/rules_android#328

rules_android_ndk
bazelbuild/rules_android_ndk#83
bazelbuild/rules_android_ndk#86
bazelbuild/rules_android_ndk#88
@ted-xie
Copy link
Contributor

ted-xie commented Jan 23, 2025

The repro command is missing -- to separate flags from targets. Please provide the correct repro command in the future.

bazel build --enable_bzlmod=false --enable_workspace=true --java_runtime_version=17 -- //android/... //src/... -//src/java/com/example/sampleapp/... //test/... -//test/rules/... //toolchains/... //tools/... -//tools/android/...

@ted-xie
Copy link
Contributor

ted-xie commented Jan 23, 2025

java_stub_template.txt was moved out of Bazel itself into rules_java: bazelbuild/rules_java@b4b0466

We will need a rules_java release where this file is publicly visible in order to address this failure.

@ted-xie ted-xie mentioned this issue Jan 23, 2025
@ted-xie
Copy link
Contributor

ted-xie commented Jan 24, 2025

This will be fixed by #331.

ted-xie added a commit to ted-xie/bazel-central-registry that referenced this issue Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants