java-language-server icon indicating copy to clipboard operation
java-language-server copied to clipboard

Bazel unavailable if a pom.xml also exists

Open emidln-imc opened this issue 3 years ago • 2 comments

InferConfig figures out the classpath based on a few heuristics[0]. Due to the ordering (and probably popularity), pom.xml is checked before bazel's WORKSPACE. This renders bazel java projects that have a pom.xml for deployment purposes unable to be used.

It would be nice to be able to optionally hint to java-language-server which project type you have to handle situations like this.

[0] https://github.com/georgewfraser/java-language-server/blob/43ffea436b9b726eb8d6721605e9c437333105b9/src/main/java/org/javacs/InferConfig.java#L51-60

emidln-imc avatar Mar 23 '22 18:03 emidln-imc

As a workaround for now, have your editor explicitly specify the Java classpath and documentation path using JSON settings. See the README.md file for details. Doing so turns off the inference process and makes the language server start more quickly.

brown avatar Jan 21 '23 23:01 brown

This is what I was doing until it got annoying enough to just fork locally to prefer bazel over maven. Would you be interested in a PR for a JSON setting that InferConfig could take into account (or something calling InferConfig could process and skip using InferConfig)?

emidln avatar Jan 23 '23 14:01 emidln