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

VS Code Dependency Resolution for Java #281

Open
mmatthews06 opened this issue Oct 3, 2022 · 7 comments
Open

VS Code Dependency Resolution for Java #281

mmatthews06 opened this issue Oct 3, 2022 · 7 comments

Comments

@mmatthews06
Copy link

I am able to build projects using this extension, but I have not been able to get VS Code to resolve external dependencies using anything that I can find in Bazel build artifacts, BUILD files or anything else. Is there a prescribed way to get VS Code to resolve import statements using anything in the Bazel ecosystem, and the VS Code Java extension pack?

Is there's a way to pull all JARs, I could probably add them as "Referenced Libraries" in the Java Projects extension, for example.

Basically, all of my external import statements are unresolved, and I'd like to know how to fix that. I could work on contributing code if this is something the extension could benefit from.

@mmatthews06
Copy link
Author

There's a StackOverflow question about this that has been open for over 2 years:
https://stackoverflow.com/questions/62112254/finding-java-imports-invscode-with-bazel

I feel like there should be a "simple" 5-step process that could resolve this, if it's not something that's trivial to implement in this extension.

@vorburger
Copy link

This severly limits the usefulness of this extension for Java projects using Bazel... 😿

The topic is a bit more general than only "Dependency Resolution" (for Java import, and Syntax Completion) for the Language support for Java by Red Hat by automatically configuring Referenced Libraries in Classpath Configuration - it also includes setting the correct Sources folder/s, or Configure Java Runtime (instead of Type: Unmanaged folder) of the JDK version, etc.

I'm wondering how hard it would be to add the missing support. Not sure if belongs more into this project or the Java by Red Hat extension (which already has similar support for Maven & Gradle); but perhaps it could be on either side.

BTW https://bazel.build/install/ide#java recommends the https://github.com/georgewfraser/java-language-server#usage extension by @georgewfraser, which is an alternative Java LS for VSC to the Java by Red Hat one. (But I personally haven't tried it out, yet.)

@guw @AlexeiShmidman @LeonovecSergey how did you go about Bazel-VSC-Java integration in your (unreleased) https://github.com/salesforce/bazel-vscode?

@meteorcloudy @fweikert @jfirebaugh @sheldonneuberger-sc @dierksen @limdor FYI

@guw
Copy link

guw commented Feb 18, 2023

@vorburger https://github.com/salesforce/bazel-vscode is an extension the the RedHat Java Language Server. It uses parts of https://github.com/salesforce/bazel-eclipse (which uses aspects) to implement the classpath resolution. I'm working on a plan to get this into a releasable state in the next few months.

@vorburger
Copy link

haven't tried https://github.com/georgewfraser/java-language-server out

I meanwhile did, and ran into some problems.

Bazel-VSC-Java integration in your (unreleased) https://github.com/salesforce/bazel-vscode
a releasable state in the next few months

ACK. I'm trying to locally build it right now, just to see if it's already "good enough" to use as-is.

I will try to make a few contribs to bazel-vscode and bazel-eclipse at least to be able to easily build it.

@moehajj
Copy link

moehajj commented Jul 9, 2023

haven't tried https://github.com/georgewfraser/java-language-server out

I meanwhile did, and ran into some problems.

I couldn't get that extension to work either.

Looks like there's been a issue open request Bazel support in the redhat extension since 2019 redhat-developer/vscode-java#909

@guw
Copy link

guw commented Jul 10, 2023

@moehajj @vorburger I need some help updating our Bazel VSCode Java extension.

We have a Bazel VSCode Java Extension at https://github.com/salesforce/bazel-vscode-java. It adds Java support for Bazel projects to VS Code based on RedHat's Java extension.

The Bazel Language Server (and the Bazel Eclipse Feature) received a significant overhaul. This update needs to be brought into the VS Code extension. Any contributions are highly appreciated. The language server can be fetched from https://opensource.salesforce.com/bazel-eclipse/latest/

@vorburger
Copy link

@guw I don't have the bandwidth to actively contribute with code (unfortunately; I would love to, this sounds, but I just don't have time for this; sorry), but salesforce/bazel-vscode-java#49 has new feedback as an end-user testing, which may be helpful.

@cameron-martin cameron-martin changed the title VS Code Dependency Resolution? VS Code Dependency Resolution for Java Mar 5, 2024
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

4 participants