bazel-vscode-java icon indicating copy to clipboard operation
bazel-vscode-java copied to clipboard

Bazel based projects not present in Java project selection

Open rleonid opened this issue 1 year ago • 3 comments

We have a large monorepo with different languages and using Bazel as our build system. I have installed the plugin, added a WORKSPACE file with (workspace(name="example")) and a .eclipse/.bazelproject with :

directories:
  lib/common_java 

derive_targets_from_directories:

targets:

lib/common_java is just one of our folders with a BUILD.bazel file and asrc/main/java folder.

When I restart vscode with the plugin enabled (the Prerelease version 😄), it does not intercept the project setup workflow when I open a .java inside of lib/common_java. The java extension pack wants to only add .gradle or maven files, and we migrated away from the former.

It also adds a large section of files.exclude to my .vscode/settings.json (even with bazel.projectview.updateFileWatcherExclusion": false) which is unfortunate.

rleonid avatar Feb 27 '24 20:02 rleonid

I am also not certain of what debug information I can provide for you, AFAIU, there isn't a dedicated output window for this plugin.

rleonid avatar Feb 27 '24 20:02 rleonid

derive_targets_from_directories is set to true?

Can you check the log files? Have you seen the troubleshooting doc here?

Note, sometimes it's also worth trying to import this into Eclipse. Eclipse is using the same engine underneath but makes errors more visible/obvious than VS Code.

guw avatar Feb 28 '24 10:02 guw

Yes, sorry that was a copy and paste error; I was trying to figure out the right arguments for that file. When I first open up code, I am greeted by image

If I Import All nothing comes up in Java Projects but if I select (and this is after Java: Clean Language Server Workspace ) Let Me Select... I only see the projects that we have vendored into our codebase, and their gradle files. (We do not use the Java there directly, it just gets distributed with their repo alongside C stuff we do use), but not our Bazel defined Java projects.

Wrt to the trouble shooting doc, yes I've tried various things from it. The first step is not working though as we are not getting a Java Projects tab. Interestingly, I also tried https://github.com/salesforce/bazel-vscode-java/blob/main/docs/troubleshoot.md#maven-or-gradle section and java.import.bazel.enabled section is not recognized by VSCode plugin as a valid setting. Which is more evidence that somehow my install is not functioning correctly.

What should I look at next? Thank you!

rleonid avatar Feb 28 '24 14:02 rleonid