georgewfraser / java-language-server

Java language server using the Java compiler API
MIT License
638 stars 125 forks source link

Shouldn't bazelClasspath resolve relatively to bazelOutputBase? #151

Open mlen opened 4 years ago

mlen commented 4 years ago

Code completion doesn't work correctly unless I patch bazelClasspath method to resolve paths relatively to bazelOutputBase

My WORKSPACE file looks like this:

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
    artifacts = ["com.google.guava:guava:29.0-jre"],
    repositories = ["https://repo1.maven.org/maven2"],
)

My BUILD file looks like this:

java_binary(
    name = "hello",
    srcs = ["Hello.java"],
    main_class = "hello.Hello",
    deps = ["@maven//:com_google_guava_guava"],
)

Is there any reason why it should resolve based on the workspace root instead of the output base dir?

georgewfraser commented 4 years ago

Hmmm...I use this with bazel myself, but I don't doubt that I might have something wrong. There's often multiple ways to get to the same path with Bazel. PR is welcome!