Skip to content

Gradle project infinitely rebuilds after launching a project #4307

Open
microsoft/vscode-gradle
#1794

Description

@ChrisTrenkamp

jls_before_run.log
jls_after_run.log

I have a multi-project Gradle project. It is not using any Eclipse settings (meaning no .project, .classpath, etc. files). The projects uses annotation processors to generate source files (they are generated under build/generated/sources/annotationProcessor/java/main by Gradle).

When the workspace is initially loaded, it works fine. The problems start after you launch a Java main class. It appears that the language server is constantly detecting changes in source files and somehow falls into an infinite loop where it continuously builds itself. It gets so bad that the workspace starts reporting compiler errors, even though there are none.

I'm not sure which factors are causing this issue to happen, so I can't provide a project that reproduces the issue. It might be a combination of Gradle with sub-projects, annotation processors, and the sheer size of the codebase. I tried changing some settings that I thought might be related to this issue with no success. I tried the current and pre-release Java Language Pack versions and the behavior is the same.

Attached are the language server logs. jls_before_run.log are the logs before I launched a main class. jls_after_run.log are the logs after I launched a main class. jls_after_run.log would have run into infinity, so I had to eventually manually stop it, so I hope there's enough information to get a clue on what's happening.

Activity

  1. ChrisTrenkamp commented on Jan 13, 2026

    @ChrisTrenkamp
    Author

    Toggling java.import.gradle.annotationProcessing.enabled has no effect.

  2. ChrisTrenkamp commented on Jan 14, 2026

    @ChrisTrenkamp
    Author

    Both Windows and Linux exhibit the same behavior.

  3. ChrisTrenkamp commented on Jan 14, 2026

    @ChrisTrenkamp
    Author

    Found a temporary workaround for this issue. I can manually launch the process in an external terminal, and attach the debugger via the "request": "attach" launch configuration. Launching with "request": "launch" triggers this bug.

  4. fbricon commented on Jan 14, 2026

    @fbricon
    Collaborator

    can you try to disable the vscode-gradle extension and run the "Clean Java Language Server Workspace" command?

  5. ChrisTrenkamp commented on Jan 14, 2026

    @ChrisTrenkamp
    Author

    That seemed to work. I had to set java.import.gradle.annotationProcessing.enabled to true so the generated source files will be generated/discovered, disabled vscode-gradle, cleaned the workspace, ran a "request": "launch" Java launch command, and did not encounter the infinite rebuild problem.

  6. wenytang-ms commented on Apr 8, 2026

    @wenytang-ms
    Contributor

    Hi @ChrisTrenkamp we've found the root cause. It’s a bit complex, so we focused on fixing the essential rebuild logic first in this new release. Could you please verify it with this version? Thank you!
    vscode-gradle 3.17.2026040802

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions