Describe the bug
When trying to import a large, multi-project Gradle build in VS Code with the latest Java and Gradle extensions, the import fails with a ConcurrentModificationException deep in the Java Build Server (BSP) integration. The error occurs even after updating to the latest extension versions, and after applying all recommended workarounds (including disabling the build server).
To Reproduce
Steps to reproduce the behavior:
- Open VS Code with the latest Java and Gradle extensions.
- Open the root folder of a large, multi-module Gradle project (with many subprojects and plugins).
- Wait for the Java project import to start.
- Observe the error in the Java/Gradle output panel.
[Error - 1:26:18 PM] 13 May 2025, 13:26:18 Initialization failed org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. java.util.concurrent.CompletionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. at java.base/java.util.concurrent.CompletableFuture.reportJoin(Unknown Source) at java.base/java.util.concurrent.CompletableFuture.join(Unknown Source) at com.microsoft.gradle.bs.importer.Utils.getBuildTargetsMappedByProjectPath(Utils.java:47) at com.microsoft.gradle.bs.importer.GradleBuildServerProjectImporter.importProjects(GradleBuildServerProjectImporter.java:322) at com.microsoft.gradle.bs.importer.GradleBuildServerProjectImporter.importToWorkspace(GradleBuildServerProjectImporter.java:226) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:164) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:126) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:263) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
** Additional Info**:
VS code version: 1.100.0 (Universal)
Gradle extension version: 3.16.4
Project Manager for Java: 0.24.1
Extension Pack for Java: 0.29.0
Java version: 17.0.8-tem
Gradle version: 7.6
My project builds and runs fine from the command line (./gradlew tasks works).
I have already refactored my build scripts to avoid mutating sourceSets, tasks, or configurations after evaluation.
I have tried disabling the build server ("java.import.gradle.buildServer.enabled": false), but the error persists.
I have also tried importing only a minimal subset of subprojects, but the error still occurs with the full project.
I found this commit which fixes a similar issue in the Gradle extension, but my error is coming from the Java Build Server integration.
Describe the bug
When trying to import a large, multi-project Gradle build in VS Code with the latest Java and Gradle extensions, the import fails with a ConcurrentModificationException deep in the Java Build Server (BSP) integration. The error occurs even after updating to the latest extension versions, and after applying all recommended workarounds (including disabling the build server).
To Reproduce
Steps to reproduce the behavior:
[Error - 1:26:18 PM] 13 May 2025, 13:26:18 Initialization failed org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. java.util.concurrent.CompletionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. at java.base/java.util.concurrent.CompletableFuture.reportJoin(Unknown Source) at java.base/java.util.concurrent.CompletableFuture.join(Unknown Source) at com.microsoft.gradle.bs.importer.Utils.getBuildTargetsMappedByProjectPath(Utils.java:47) at com.microsoft.gradle.bs.importer.GradleBuildServerProjectImporter.importProjects(GradleBuildServerProjectImporter.java:322) at com.microsoft.gradle.bs.importer.GradleBuildServerProjectImporter.importToWorkspace(GradleBuildServerProjectImporter.java:226) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:164) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:126) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:263) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: java.lang.IllegalStateException: org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception. at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)** Additional Info**:
VS code version: 1.100.0 (Universal)
Gradle extension version: 3.16.4
Project Manager for Java: 0.24.1
Extension Pack for Java: 0.29.0
Java version: 17.0.8-tem
Gradle version: 7.6
My project builds and runs fine from the command line (./gradlew tasks works).
I have already refactored my build scripts to avoid mutating sourceSets, tasks, or configurations after evaluation.
I have tried disabling the build server ("java.import.gradle.buildServer.enabled": false), but the error persists.
I have also tried importing only a minimal subset of subprojects, but the error still occurs with the full project.
I found this commit which fixes a similar issue in the Gradle extension, but my error is coming from the Java Build Server integration.