After I upgraded to Java 17 (from 11), VSCode, with the java pack, will no longer recognize java projects.
It is a maven project, with a pom file in the root folder and then multiple projects below, like the three shown in the picture above.
It recognizes the maven part just fine, but no java projects.
I tried:
- Setting the JAVA_HOME variable
- Setting the "java.jdt.ls.java.home"
- Setting a config in "java.configuration.runtimes"
What can I do to make VSCode recognize my java projects?
3
Answers
Setting the the maven.userSettings in settings.json did the trick!
For some reason this wasn't needed when I used Java 11, but now with Java 17 it apparently doesn't find it automatically.
EDIT: My mistake, it can find it, I was missing the settings file in my .m2 folder, after putting it there, I don't need to set the path as above.
So yea, either put the settings file in the home/.m2 folder or set the
java.configuration.maven.userSettings
Possible workarounds
Add the following configuration to the settings.json file
In my case i found that the
.project
file was missing the following:and
I came to this conclusion after creating a new project in the Java Project area, and comparing the files.
There were also entries missing in the
.settings/org.eclipse.jdt.core.prefs
file, but adding them didn’t fix the problem until I added the above.