Open JoshTRN opened 5 months ago
Hi! I'm facing similar issue. @JoshTRN Ware you able to resolve this?
The workspace fails to detect java core libraries and dependencies.
With lsp-java-configuration-runtimes
The type java.lang.Object...
goes away and I get some completion working for java core (I still get the error in log), but not for dependencies e.g. The import org.junit cannot be resolved
Doom Emacs
on Arch Linux
with the (java +lsp +tree-sitter)
modulejava --version
installed with jabba
:
openjdk 21.0.2 2024-01-16
OpenJDK Runtime Environment (build 21.0.2+13-58)
OpenJDK 64-Bit Server VM (build 21.0.2+13-58, mixed mode, sharing)
lsp-workspace-folder
root set to same dir as where gradle init
was run
openjdk@1.21.0-2
with jabba
Gradle 8.9
Application
project with defaults (JUnit Juniper for testing) App.java
or AppTest.java
lsp-java-configuration-runtimes
:
(after! lsp-java
(setq lsp-java-java-path (concat (getenv "JAVA_HOME") "/bin/java"))
(setq lsp-java-configuration-runtimes `[
(:name "JavaSE-21"
:path ,(getenv "JAVA_HOME")
:default t)]))
.envrc
:
PATH_add ~/.jabba/jdk/openjdk@1.21.0-2
JAVA_HOME=~/.jabba/jdk/openjdk@1.21.0-2
Jul 30, 2024, 1:17:33 PM ProjectRegistryRefreshJob finished 29621ms
Jul 30, 2024, 1:17:33 PM Started org.eclipse.buildship.core 0ms
Creating watchers for following 61 folders:
/home/user/Documents/Code/sandbox/Java/Test
/home/user/Documents/Code/sandbox/Java/Test/.settings
/home/user/Documents/Code/sandbox/Java/Test/app
/home/user/Documents/Code/sandbox/Java/Test/app/.settings
/home/user/Documents/Code/sandbox/Java/Test/app/bin
/home/user/Documents/Code/sandbox/Java/Test/app/bin/main
/home/user/Documents/Code/sandbox/Java/Test/app/bin/main/org
/home/user/Documents/Code/sandbox/Java/Test/app/bin/main/org/example
/home/user/Documents/Code/sandbox/Java/Test/app/bin/test
/home/user/Documents/Code/sandbox/Java/Test/app/bin/test/org
/home/user/Documents/Code/sandbox/Java/Test/app/bin/test/org/example
/home/user/Documents/Code/sandbox/Java/Test/app/build
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes/java
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes/java/main
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes/java/main/org
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes/java/main/org/example
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes/java/test
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes/java/test/org
/home/user/Documents/Code/sandbox/Java/Test/app/build/classes/java/test/org/example
/home/user/Documents/Code/sandbox/Java/Test/app/build/distributions
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/annotationProcessor
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/annotationProcessor/java
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/annotationProcessor/java/main
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/annotationProcessor/java/test
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/headers
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/headers/java
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/headers/java/main
/home/user/Documents/Code/sandbox/Java/Test/app/build/generated/sources/headers/java/test
/home/user/Documents/Code/sandbox/Java/Test/app/build/libs
/home/user/Documents/Code/sandbox/Java/Test/app/build/reports
/home/user/Documents/Code/sandbox/Java/Test/app/build/reports/tests
/home/user/Documents/Code/sandbox/Java/Test/app/build/reports/tests/test
/home/user/Documents/Code/sandbox/Java/Test/app/build/reports/tests/test/classes
/home/user/Documents/Code/sandbox/Java/Test/app/build/reports/tests/test/css
/home/user/Documents/Code/sandbox/Java/Test/app/build/reports/tests/test/js
/home/user/Documents/Code/sandbox/Java/Test/app/build/reports/tests/test/packages
/home/user/Documents/Code/sandbox/Java/Test/app/build/scripts
/home/user/Documents/Code/sandbox/Java/Test/app/build/test-results
/home/user/Documents/Code/sandbox/Java/Test/app/build/test-results/test
/home/user/Documents/Code/sandbox/Java/Test/app/build/test-results/test/binary
/home/user/Documents/Code/sandbox/Java/Test/app/build/tmp
/home/user/Documents/Code/sandbox/Java/Test/app/build/tmp/compileJava
/home/user/Documents/Code/sandbox/Java/Test/app/build/tmp/compileTestJava
/home/user/Documents/Code/sandbox/Java/Test/app/build/tmp/jar
/home/user/Documents/Code/sandbox/Java/Test/app/build/tmp/test
/home/user/Documents/Code/sandbox/Java/Test/app/src
/home/user/Documents/Code/sandbox/Java/Test/app/src/main
/home/user/Documents/Code/sandbox/Java/Test/app/src/main/java
/home/user/Documents/Code/sandbox/Java/Test/app/src/main/java/org
/home/user/Documents/Code/sandbox/Java/Test/app/src/main/java/org/example
/home/user/Documents/Code/sandbox/Java/Test/app/src/main/resources
/home/user/Documents/Code/sandbox/Java/Test/app/src/test
/home/user/Documents/Code/sandbox/Java/Test/app/src/test/java
/home/user/Documents/Code/sandbox/Java/Test/app/src/test/java/org
/home/user/Documents/Code/sandbox/Java/Test/app/src/test/java/org/example
/home/user/Documents/Code/sandbox/Java/Test/app/src/test/resources
/home/user/Documents/Code/sandbox/Java/Test/gradle
/home/user/Documents/Code/sandbox/Java/Test/gradle/wrapper
Jul 30, 2024, 1:17:34 PM Project configurator 'org.eclipse.buildship.configurators.base' failed to configure project 'app'
Cannot convert string value 'VERSION_21' to an enum value of type 'org.gradle.api.JavaVersion' (valid case insensitive values: VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_1_9, VERSION_1_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18, VERSION_19, VERSION_20, VERSION_HIGHER)
java.lang.IllegalArgumentException: Cannot convert string value 'VERSION_21' to an enum value of type 'org.gradle.api.JavaVersion' (valid case insensitive values: VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_1_9, VERSION_1_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18, VERSION_19, VERSION_20, VERSION_HIGHER)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.toEnum(ProtocolToModelAdapter.java:204)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.adaptToEnum(ProtocolToModelAdapter.java:177)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.createView(ProtocolToModelAdapter.java:146)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.convert(ProtocolToModelAdapter.java:276)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.access$1500(ProtocolToModelAdapter.java:56)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$AdaptingMethodInvoker.invoke(ProtocolToModelAdapter.java:477)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$PropertyCachingMethodInvoker.invoke(ProtocolToModelAdapter.java:705)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SafeMethodInvoker.invoke(ProtocolToModelAdapter.java:742)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SupportedPropertyInvoker.invoke(ProtocolToModelAdapter.java:766)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:432)
at jdk.proxy8/jdk.proxy8.$Proxy66.getSourceLanguageLevel(Unknown Source)
at org.eclipse.buildship.core.internal.util.gradle.CompatSourceSettings.getSourceLanguageLevel(CompatSourceSettings.java:42)
at org.eclipse.buildship.core.internal.workspace.JavaSourceSettingsUpdater.update(JavaSourceSettingsUpdater.java:37)
at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProjectInTransaction(BaseConfigurator.java:119)
at org.eclipse.buildship.core.internal.workspace.BaseConfigurator$1.run(BaseConfigurator.java:105)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5961)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5918)
at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProject(BaseConfigurator.java:101)
at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:91)
at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:66)
at org.eclipse.buildship.core.internal.extension.InternalProjectConfigurator.configure(InternalProjectConfigurator.java:65)
at org.eclipse.buildship.core.internal.workspace.ProjectConfigurators.configureConfigurators(ProjectConfigurators.java:70)
at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeOpenWorkspaceProject(SynchronizeGradleBuildOperation.java:163)
at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeWorkspaceProject(SynchronizeGradleBuildOperation.java:137)
at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:127)
at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:85)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2402)
at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeProjectsWithWorkspace(SynchronizeGradleBuildOperation.java:82)
at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:64)
at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.runInToolingApi(DefaultGradleBuild.java:232)
at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407)
at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39)
at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.run(DefaultGradleBuild.java:194)
at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:102)
at org.eclipse.buildship.core.internal.workspace.SynchronizationJob.runInToolingApi(SynchronizationJob.java:64)
at org.eclipse.buildship.core.internal.workspace.SynchronizationJob.runInToolingApi(SynchronizationJob.java:30)
at org.eclipse.buildship.core.internal.operation.ToolingApiJob$1.runInToolingApi(ToolingApiJob.java:54)
at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407)
at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39)
at org.eclipse.buildship.core.internal.operation.ToolingApiJob.run(ToolingApiJob.java:65)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Jul 30, 2024, 1:17:34 PM Synchronize Gradle projects with workspace failed due to an unexpected error. Cannot convert string value 'VERSION_21' to an enum value of type 'org.gradle.api.JavaVersion' (valid case insensitive values: VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_1_9, VERSION_1_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18, VERSION_19, VERSION_20, VERSION_HIGHER) java.lang.IllegalArgumentException: Cannot convert string value 'VERSION_21' to an enum value of type 'org.gradle.api.JavaVersion' (valid case insensitive values: VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_1_9, VERSION_1_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18, VERSION_19, VERSION_20, VERSION_HIGHER) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.toEnum(ProtocolToModelAdapter.java:204) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.adaptToEnum(ProtocolToModelAdapter.java:177) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.createView(ProtocolToModelAdapter.java:146) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.convert(ProtocolToModelAdapter.java:276) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.access$1500(ProtocolToModelAdapter.java:56) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$AdaptingMethodInvoker.invoke(ProtocolToModelAdapter.java:477) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$PropertyCachingMethodInvoker.invoke(ProtocolToModelAdapter.java:705) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SafeMethodInvoker.invoke(ProtocolToModelAdapter.java:742) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SupportedPropertyInvoker.invoke(ProtocolToModelAdapter.java:766) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:432) at jdk.proxy8/jdk.proxy8.$Proxy66.getSourceLanguageLevel(Unknown Source) at org.eclipse.buildship.core.internal.util.gradle.CompatSourceSettings.getSourceLanguageLevel(CompatSourceSettings.java:42) at org.eclipse.buildship.core.internal.workspace.JavaSourceSettingsUpdater.update(JavaSourceSettingsUpdater.java:37) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProjectInTransaction(BaseConfigurator.java:119) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator$1.run(BaseConfigurator.java:105) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5961) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5918) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProject(BaseConfigurator.java:101) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:91) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:66) at org.eclipse.buildship.core.internal.extension.InternalProjectConfigurator.configure(InternalProjectConfigurator.java:65) at org.eclipse.buildship.core.internal.workspace.ProjectConfigurators.configureConfigurators(ProjectConfigurators.java:70) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeOpenWorkspaceProject(SynchronizeGradleBuildOperation.java:163) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeWorkspaceProject(SynchronizeGradleBuildOperation.java:137) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:127) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:85) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2402) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeProjectsWithWorkspace(SynchronizeGradleBuildOperation.java:82) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:64) at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.runInToolingApi(DefaultGradleBuild.java:232) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39) at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.run(DefaultGradleBuild.java:194) at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:102) at org.eclipse.buildship.core.internal.workspace.SynchronizationJob.runInToolingApi(SynchronizationJob.java:64) at org.eclipse.buildship.core.internal.workspace.SynchronizationJob.runInToolingApi(SynchronizationJob.java:30) at org.eclipse.buildship.core.internal.operation.ToolingApiJob$1.runInToolingApi(ToolingApiJob.java:54) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39) at org.eclipse.buildship.core.internal.operation.ToolingApiJob.run(ToolingApiJob.java:65) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Jul 30, 2024, 1:17:34 PM >> initialized Init...[Starting] 0% Starting Java Language Server[Starting] Jul 30, 2024, 1:17:34 PM RepositoryRegistryUpdateJob finished 0ms Jul 30, 2024, 1:17:34 PM Importing Gradle project(s) Jul 30, 2024, 1:17:34 PM Test was modified since last time the workspace was opened, must be synchronized 55% Starting Java Language Server[Starting] Jul 30, 2024, 1:17:38 PM Project configurator 'org.eclipse.buildship.configurators.base' failed to configure project 'app' Cannot convert string value 'VERSION_21' to an enum value of type 'org.gradle.api.JavaVersion' (valid case insensitive values: VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_1_9, VERSION_1_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18, VERSION_19, VERSION_20, VERSION_HIGHER) java.lang.IllegalArgumentException: Cannot convert string value 'VERSION_21' to an enum value of type 'org.gradle.api.JavaVersion' (valid case insensitive values: VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_1_9, VERSION_1_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18, VERSION_19, VERSION_20, VERSION_HIGHER) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.toEnum(ProtocolToModelAdapter.java:204) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.adaptToEnum(ProtocolToModelAdapter.java:177) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.createView(ProtocolToModelAdapter.java:146) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.convert(ProtocolToModelAdapter.java:276) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.access$1500(ProtocolToModelAdapter.java:56) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$AdaptingMethodInvoker.invoke(ProtocolToModelAdapter.java:477) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$PropertyCachingMethodInvoker.invoke(ProtocolToModelAdapter.java:705) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SafeMethodInvoker.invoke(ProtocolToModelAdapter.java:742) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SupportedPropertyInvoker.invoke(ProtocolToModelAdapter.java:766) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:432) at jdk.proxy8/jdk.proxy8.$Proxy66.getSourceLanguageLevel(Unknown Source) at org.eclipse.buildship.core.internal.util.gradle.CompatSourceSettings.getSourceLanguageLevel(CompatSourceSettings.java:42) at org.eclipse.buildship.core.internal.workspace.JavaSourceSettingsUpdater.update(JavaSourceSettingsUpdater.java:37) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProjectInTransaction(BaseConfigurator.java:119) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator$1.run(BaseConfigurator.java:105) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5961) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5918) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProject(BaseConfigurator.java:101) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:91) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:66) at org.eclipse.buildship.core.internal.extension.InternalProjectConfigurator.configure(InternalProjectConfigurator.java:65) at org.eclipse.buildship.core.internal.workspace.ProjectConfigurators.configureConfigurators(ProjectConfigurators.java:70) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeOpenWorkspaceProject(SynchronizeGradleBuildOperation.java:163) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeWorkspaceProject(SynchronizeGradleBuildOperation.java:137) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:127) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:85) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2402) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeProjectsWithWorkspace(SynchronizeGradleBuildOperation.java:82) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:64) at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.runInToolingApi(DefaultGradleBuild.java:232) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39) at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.run(DefaultGradleBuild.java:194) at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:102) at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:88) at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.startSynchronization(GradleProjectImporter.java:409) at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.importDir(GradleProjectImporter.java:297) at org.eclipse.jdt.ls.core.internal.managers.GradleProjectImporter.importToWorkspace(GradleProjectImporter.java:210) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:150) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:112) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:257) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
WARNING[ProjectStatus] 100% Starting Java Language Server[Starting] Jul 30, 2024, 1:17:38 PM Workspace initialized in 4604ms Ready[Started] 100% Starting Java Language Server[Starting] Jul 30, 2024, 1:17:38 PM >> initialization job finished Jul 30, 2024, 1:17:38 PM >> registerWatchers' Jul 30, 2024, 1:17:38 PM Runtime JavaEnvironment [name=JavaSE-21, path=null, javadoc=null, sources=null] is not valid. Jul 30, 2024, 1:17:38 PM >> registerFeature 'workspace/didChangeWatchedFiles' Creating watchers for following 2 folders: /home/user/Documents/Code/sandbox/Java/Test/app/bin/main/org /home/user/Documents/Code/sandbox/Java/Test/app/bin/main/org/example Creating watchers for following 2 folders: /home/user/Documents/Code/sandbox/Java/Test/app/bin/test/org /home/user/Documents/Code/sandbox/Java/Test/app/bin/test/org/example Jul 30, 2024, 1:17:39 PM Error occured while building workspace. Details: message: Can't use Java 21 and Gradle 8.9 to import Gradle project Test.; code: 0; resource: /home/user/Documents/Code/sandbox/Java/Test; line: 1 message: Project configurator 'org.eclipse.buildship.configurators.base' failed to configure project 'app'; code: 0; resource: /home/user/Documents/Code/sandbox/Java/Test/app; message: The import org.junit cannot be resolved; code: 268435846; resource: /home/user/Documents/Code/sandbox/Java/Test/app/src/test/java/org/example/AppTest.java; line: 6 message: The import org.junit cannot be resolved; code: 268435846; resource: /home/user/Documents/Code/sandbox/Java/Test/app/src/test/java/org/example/AppTest.java; line: 8 message: Test cannot be resolved to a type; code: 16777218; resource: /home/user/Documents/Code/sandbox/Java/Test/app/src/test/java/org/example/AppTest.java; line: 11 message: The method assertNotNull(String, String) is undefined for the type AppTest; code: 67108964; resource: /home/user/Documents/Code/sandbox/Java/Test/app/src/test/java/org/example/AppTest.java; line: 14 ServiceReady[ServiceReady] Jul 30, 2024, 1:17:39 PM An internal error occurred during: "Initialize workspace". Model not available for app org.eclipse.buildship.core.internal.GradlePluginsRuntimeException: Model not available for app at org.eclipse.buildship.core.internal.workspace.GradleClasspathContainerRuntimeClasspathEntryResolver.resolveRuntimeClasspathEntry(GradleClasspathContainerRuntimeClasspathEntryResolver.java:82) at org.eclipse.buildship.core.internal.workspace.GradleClasspathContainerRuntimeClasspathEntryResolver.resolveRuntimeClasspathEntry(GradleClasspathContainerRuntimeClasspathEntryResolver.java:58) at org.eclipse.jdt.internal.launching.RuntimeClasspathEntryResolver.resolveRuntimeClasspathEntry(RuntimeClasspathEntryResolver.java:49) at org.eclipse.jdt.launching.JavaRuntime.resolveRuntimeClasspathEntry(JavaRuntime.java:1259) at org.eclipse.buildship.core.internal.launch.GradleClasspathProvider.resolveClasspath(GradleClasspathProvider.java:101) at org.eclipse.jdt.internal.launching.RuntimeClasspathProvider.resolveClasspath(RuntimeClasspathProvider.java:68) at org.eclipse.jdt.launching.JavaRuntime.resolveRuntimeClasspath(JavaRuntime.java:1661) at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.getClasspathAndModulepath(AbstractJavaLaunchConfigurationDelegate.java:464) at org.eclipse.jdt.ls.core.internal.commands.ProjectCommand$1.run(ProjectCommand.java:176) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2382) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2407) at org.eclipse.jdt.ls.core.internal.commands.ProjectCommand.getClasspathsFromJavaProject(ProjectCommand.java:173) at org.eclipse.jdt.ls.core.internal.preferences.Preferences.getAnnotationType(Preferences.java:2296) at org.eclipse.jdt.ls.core.internal.preferences.Preferences.hasAnnotationNullAnalysisTypes(Preferences.java:2284) at org.eclipse.jdt.ls.core.internal.preferences.Preferences.updateAnnotationNullAnalysisOptions(Preferences.java:2219) at org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.projectsImported(StandardProjectsManager.java:649) at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer$2.run(JDTLanguageServer.java:307) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
100% Starting Java Language Server[Starting] 100% Starting Java Language Server - Synchronize Gradle project app with workspace project[Starting] 100% Starting Java Language Server[Starting]
I've managed to fix it!
Setting lsp-java-jdt-download-url
to https://www.eclipse.org/downloads/download.php?file=/jdtls/milestones/1.37.0/jdt-language-server-1.37.0-202406271335.tar.gz
(latest jdtls release as of today (30.07.2024) fixed the issue.
The default jdtls
in lsp-java
is 1.26 which is older than JDK 21 release date.
'(lsp-java-jdt-download-url
"https://www.eclipse.org/downloads/download.php?file=/jdtls/milestones/1.37.0/jdt-language-server-1.37.0-202406271335.tar.gz")
@AnonymusBadger worked for me, thanks for this!
I've just spent a million years trying to fix the error related to java version, just to find out it was an old JDT-ls version 🤦 for the fellow noobs who might be struggling:
lsp-java-jdt-download-url
M-x
-> lsp-update-server
Describe the bug The workspace fails to detect java core libraries and doesn't work on Apple M3 air.
Note
java
layer which installslsp-java
java -version
output:To Reproduce On Apple M3 macbook air:
brew install java
(this should install 21.0.3)DemoApplication.java
lsp-java-configuration-runtimes
Expected behavior All the standard library and dependencies should be detected and all the standard lsp-java apis should function normally.
Screenshots
Logs