bazel
bazel copied to clipboard
Bazel 7 queries produces missing jar files for rules_jvm_external
Description of the bug:
We’re seeing some strangeness recently with Bazel 7/7.1.0/7.1.1
Not sure how to reproduce yet outside of our repo and seeing if anyone has noticed anything similar.
We’re finding that if you don’t have anything cached and do a query first instead of a build that rules_jvm_external maven dependencies are missing jar files in ‘bazel-bin/external/maven/…’
Once this happens even if you do a build the directories never get a jar file and builds fail with ‘java.lang.NoClassDefFoundError’
If you do a build first instead of a query jars get created as usual.
The above happens in Linux and macOS.
There may be a related error where we see queries hang and never complete but that might be related to MacOS Sonoma Java.
Sample query that produces both issues for us: ‘bazel query “deps(//…)” —notool_deps —output=streamed_jsonproto > myfile
Which category does this issue belong to?
Core, Java Rules
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Not determined yet
Which operating system are you running Bazel on?
Linux and MacOS 14.4.1
What is the output of bazel info release
?
No response
If bazel info release
returns development version
or (@non-git)
, tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD
?
No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
GitHub issue #21712 might be related to the second part but might be unrelated to first part
Any other information, logs, or outputs that you want to share?
No response
That you aren't seeing the jar files is likely working as expected if you use a disk or remote cache due to --remote_download_outputs=toplevel
being the default in Bazel 7.
That doesn't explain the NoClassDefFoundError
though. Do you have a shareable example setup that reproduces this issue?
Trying to reproduce this in a toy repo.
Unfortunately in the toy repo when I do a query the bazel-bin directory is not created but in the real repo it does get created when doing a query.
There must be something in our .bazelrc config that might be making it generate a bazel-bin...
I will continue to investigate.
This is the repo in the meantime if others have a similar issue and want to experiment: https://github.com/carolosf/bazel-21814