vscode-gradle icon indicating copy to clipboard operation
vscode-gradle copied to clipboard

Gradle picks up "random" JDK in WSL and ignores settings.json

Open mklueh opened this issue 2 years ago • 0 comments
trafficstars

Extension Name: vscode-gradle Extension Version: latest OS Version: OS Version: Ubuntu 20.04 WSL 2 / Windows 11

VS Code Version: Version: 1.76.1 (user setup) Date: 2023-03-08T16:32:00.131Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Windows_NT x64 10.0.22621 Sandboxed: No

Describe the bug Gradle seems to pick up any other JDK during configure phase, but not the one specified in the settings.

[info] Java Home: /home/linuxbrew/.linuxbrew/Cellar/openjdk/19.0.1/libexec

To Reproduce

settings.json (wsl)

{
    "java.import.gradle.java.home": "/home/user/.jdks/openjdk-19.0.2",
    "java.jdt.ls.java.home": "/home/user/.jdks/openjdk-19.0.2",
    "gradle.nestedProjects": false
}

Click "Refresh Gradle Projects View".

I've tried it with and without "java.import.gradle.java.home" - my understanding is, it is optional and if not set Gradle will use "java.jdt.ls.java.home".

Also testwise added the path to all three settings.json (user, remote, workspace).

Expected behavior To pick up the specified JDK

Screenshots If applicable, add screenshots to help explain your problem.

Output from "Gradle for Java"

[info] [gradle-server] Server started, listening on 42097 [info] Gradle client connected to server [info] Java Home: /home/linuxbrew/.linuxbrew/Cellar/openjdk/19.0.1/libexec [info] JVM Args: -XX:MaxMetaspaceSize=1g,--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx5g,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant [info] Gradle User Home: /home/user/.gradle [info] Gradle Version: 8.0.2

Does the bug still exist if you disable all other extensions? Yes/No

Additional context Add any other context about the problem here.

mklueh avatar Mar 14 '23 07:03 mklueh