External libraries not resolved in IntelliJ after upgrading Bazel from 7 to 8
After updating from Bazel 7.6.1 to 8.2.1 external dependencies stop appearing in IntelliJ. The project builds successfully with Bazel CLI, but IntelliJ no longer shows external libraries under "External Libraries" and can't resolve imports.
Which category does this issue belong to?
Intellij
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- Add
rules_jvm_externaltoexamples/scala/with_bzlmodin (see my fork https://github.com/bazelbuild/intellij/compare/master...sebastianvoss:intellij:master) - Set
.bazelversionto 7.6.1 - Sync the project in IntelliJ. External libraries are correctly listed and resolvable.
- Change
.bazelversionto 8.2.1 - Sync the project again. External libraries are not listed.
Which Intellij IDE are you using? Please provide the specific version.
OS: macOS 15.4.1 IntelliJ Version: IntelliJ IDEA Ultimate 2025.1.1.1 Bazel Version: 8.2.1 (works fine in 7.6.1) Dependency System: rules_jvm_external (bzlmod) Project Type: Scala
What programming languages and tools are you using? Please provide specific versions.
Scala
What Bazel plugin version are you using?
Bazel Plugin Version: 2025.04.29.0.1-api-version-251
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
Reproduction fork: https://github.com/bazelbuild/intellij/compare/master...sebastianvoss:intellij:master
This might be a duplicate of #7676.
However, the new Bazel plugin doesn't seem to have this issue. Can you check if it works with your project?
@odisseus Thanks for your feedback.
I tested the new Bazel EAP plugin. While it successfully adds external libraries, it struggles with cross-version Scala projects - which work fine with the current stable plugin. The main issues include red compilation errors and ignored Scala compiler flags (e.g., -Xsource:3).
For now, we'll continue using Bazel 7.x for development and reserve Bazel 8 for CI/CD.
The root cause lies in the inability to retrieve the JavaInfo provider by one of the sync aspects. Prior to Bazel 8, every provider was accessible as a simple set of fields in the target, but now it must be accessed as an object of certain type. Scala targets actually provide that object, but our aspect cannot access it if JavaInfo is not defined within the workspace itself.
As a workaround, try adding rules_java to your MODULE.bazel, even if your project doesn't use it directly. This should do the trick:
bazel_dep(name = "rules_java", version = "7.6.0")