fwcd / kotlin-language-server

Kotlin code completion, diagnostics and more for any editor/IDE using the Language Server Protocol
MIT License
1.62k stars 203 forks source link

Can't build, any command returns BUILD FAILED #485

Open victorpigmeo opened 1 year ago

victorpigmeo commented 1 year ago

Hello, it is my first time trying kotling and since I use emacs I want a lsp server to connect but every try to build/install this server result in a error. I don´t know if I'm doing something wrong, it is also the first time I use gradle since the early days of android development on android studio 😅 I just git clone the repo and try the command, but doesn't matter what I input as arg to ./gradlew I got this same output. At first I thought it could be because I was using java installed by nix but even using sdkman the error persists

~/dev/kotlin-language-server main > ./gradlew :server:installDist                                                                                                                                                                   09:40:26

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of null.
> Could not resolve all dependencies for configuration ':buildSrc:buildScriptClasspath'.
   > Failed to calculate the value of task ':buildSrc:compileJava' property 'javaCompiler'.
      > No matching toolchains found for requested specification: {languageVersion=11, vendor=any, implementation=vendor-specific}.
         > No locally installed toolchains match (see https://docs.gradle.org/8.1/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.1/userguide/toolchains.html#sub:download_repositories).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 518ms
fwcd commented 1 year ago

The build script currently searches for Java 11 by default, but you can override this by passing a custom version (which is also what the CI build does), e.g. for Java 17:

./gradlew :server:installDist -PjavaVersion=17

The mechanism for this is Gradle's toolchains, which are intended to provide a more deterministic build environment by pinning the Java version.