fwcd / kotlin-language-server

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

Make it clear JDK 11 is required to build without adding `-PjavaVersion=` to arguments of `gradlew` & Prepare to support build using Java 17+ #463

Open tats-u opened 1 year ago

tats-u commented 1 year ago

https://github.com/fwcd/kotlin-language-server/blob/bc5309964d24053dd80aed193975629c3e8546ca/gradle.properties#L2

./gradlew fails due to this line. Support Java 17. Java 11 will be EOL in this (Oracle JDK's Premier Support) or next year (Temurin).

↓ Java 17 or 20

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 4s

↓ Java 11

Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

> Task :help

Welcome to Gradle 8.1.

To run a build, run gradlew <task> ...

To see a list of available tasks, run gradlew tasks

To see more detail about a task, run gradlew help --task <task>

To see a list of command-line options, run gradlew --help

For more detail on using Gradle, see https://docs.gradle.org/8.1/userguide/command_line_interface.html

For troubleshooting, visit https://help.gradle.org

BUILD SUCCESSFUL in 1m 52s
11 actionable tasks: 11 executed
<-------------> 0% WAITING
> IDLE
> IDLE
themkat commented 1 year ago

If you check what the build pipeline is doing, you will see that you can override the property using -PjavaVersion=17 to build on Java 17: https://github.com/fwcd/kotlin-language-server/blob/main/.github/workflows/build.yml#L27

We should probably at one point in the future make Java 17 the default, but unsure when that might be.

tats-u commented 1 year ago

Are any additional settings required for IntelliJ (Community) without the target JDK setting to 11?

themkat commented 1 year ago

IntelliJ? No clue, I avoid that shit when I can 😛

My main guess would be to edit your run configurations. Next to your run and debug buttons there should be a drop down menu or something with a button called Edit configurations. Then you should be able to put in the commands and arguments (e.g, :server:build -PjavaVersion=17).

tats-u commented 1 year ago

Without JDK 11, even auto-completion seems to fail. I feel like registering tasks isn't related to that issue. I'll resign myself to JDK 11.