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 based projects not present in Java project selection #106

Open
rleonid opened this issue Feb 27, 2024 · 3 comments
Open

Bazel based projects not present in Java project selection #106

rleonid opened this issue Feb 27, 2024 · 3 comments

Comments

@rleonid
Copy link

rleonid commented Feb 27, 2024

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
Copy link
Author

rleonid commented Feb 27, 2024

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.

@guw
Copy link
Collaborator

guw commented Feb 28, 2024

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.

@rleonid
Copy link
Author

rleonid commented Feb 28, 2024

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!

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