-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[jb] Use the default Java SDK version when there's no explicit configuration for it yet #12163
Conversation
.../jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodProjectManager.kt
Show resolved
Hide resolved
5d648fb
to
284750b
Compare
284750b
to
b90afde
Compare
b90afde
to
f4e15cc
Compare
526ca96
to
6baab9a
Compare
I've tried a lot of things, but I'm still facing this error (which I confirmed is also happening with the code from main branch, indicating it's due to some logic change on the latest IDEs).
|
Could you ask JB folks please? |
6baab9a
to
ef3874c
Compare
.../jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodProjectManager.kt
Outdated
Show resolved
Hide resolved
.../jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodProjectManager.kt
Outdated
Show resolved
Hide resolved
.../jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodProjectManager.kt
Outdated
Show resolved
Hide resolved
c6ccbe7
to
3d1a90a
Compare
.../jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodProjectManager.kt
Outdated
Show resolved
Hide resolved
83e95d3
to
173dd34
Compare
/werft run 👍 started the job as gitpod-build-felladrin-12030.22 |
173dd34
to
41a0a1d
Compare
41a0a1d
to
b7d8c08
Compare
I’ve updated the code, and now it avoids creating duplicated JDKs. For reference, running on the dev server is working like this: For https://github.com/gitpod-io/spring-petclinic:
For https://github.com/spring-projects/spring-petclinic:
|
I found out the cause of https://github.com/spring-projects/spring-petclinic/ not connecting and not using the expected JDK:
I've replaced it with this other repo: https://github.com/gitpod-io/template-java-spring-boot It's now ready for review again. |
@felladrin could you create an issue for it and add into IDE project please? 🙏 |
@andreafalzetti Could you help to verify it? 🙏 |
Code-wise it looks good. |
Reviewing this now 👀 |
The prev env is broken, I am going to rebuild it /werft run with-clean-slate-deployment 👍 started the job as gitpod-build-felladrin-12030.27 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as advertised!
Description
Currently, when we open a Java Workspace, it selects Java 17 as SDK by default:
This PR changes it to use the JDK preferred by the user (the ones defined in JAVA_HOME or PATH environment variables), in case it's not defined in a configuration file yet (e.g.
.idea/misc.xml
):How does it work
jdkTable.preconfigure()
will set theProjectRootManager.getInstance(project).projectSdk
to a specific version if there’s an.idea/misc.xml
file defining the JDK for the project.And if there’s no configuration file, it will add a JDK to the list of available SDKs but won't set up the project SDK. That's where we set them up with the default JDK version found by
JavaHomeFinder.
Related Issue(s)
Fixes #12030
How to test
.idea/misc.xml
:a. Start a workspace using this repository: https://github.com/gitpod-io/spring-petclinic
b. Verify that the workspace starts successfully
c. Verify that the IDE opens successfully
d. In JetBrains Client, open the menu "File" >> "Project Structure" and check if it's using the same JDK version as the one defined in
.idea/misc.xml
.e. Stop the workspace and restart it. Now confirm there are no duplicated SDKs listed in
File >> Project Structure >> Platform Settings >> SDKs
..idea/misc.xml
or doesn't contain that file at all:a. Start a workspace using this repository: https://github.com/gitpod-io/template-java-spring-boot
b. Verify that the workspace starts successfully
c. Verify that the IDE opens successfully
d. In JetBrains Client, open the menu "File" >> "Project Structure" and check if it's using the same JDK version as the one you see when you run
echo $JAVA_HOME
on the terminal. (Notice there are also other auto-detected JDKs listed, allowing users to change it if they want.)e. Stop the workspace and restart it. Now confirm there are no duplicated SDKs listed in
File >> Project Structure >> Platform Settings >> SDKs
.Release Notes
Documentation
None.
Werft options: