vscode-gradle icon indicating copy to clipboard operation
vscode-gradle copied to clipboard

Gradle extension should start to synchronize project after `redhat.java` is ready

Open CsCherrYY opened this issue 3 years ago • 1 comments

If the users have both redhat.java and vscode-gradle installed, for a new project, the two extensions are trying to import (or synchronize) the project at the same time, which might cause some confused or extra things (e.g., two Gradle daemons will download dependency for a single project), or Gradle daemon has done some things to avoid this, but we should have some well-organized lifecycle.

So the Gradle extension should start to synchronize project (call getBuild()) after redhat.java has successfully imported the project. We may use serverReady() API from redhat.java side.

CsCherrYY avatar Aug 15 '22 06:08 CsCherrYY

Hi @CsCherrYY, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

  • Use VS Code’s extension dependency mechanism to ensure the Gradle extension only activates after Red Hat Java is ready:

    // package.json
    "extensionDependencies": [
      "redhat.java"
    ]
    

    This relies on the fact that Red Hat Java won’t finish activation (and fire its ready event) until project import is complete. (#1164)

  • After activating Red Hat Java, call its serverReady() API before running getBuild():

    const javaExt = vscode.extensions.getExtension('redhat.java');
    await javaExt.activate();
    await javaExt.exports.serverReady();
    // now safe to call getBuild()
    
  • Respect the user’s java.import.gradle.enabled setting so that synchronization only happens when enabled. (#1290)

Other references with low confidence
  • Project manager extension dependency discussion; consider depending on the Java Extension Pack for faster activation. (#543)
  • Workarounds for multiple Gradle imports (disable java.gradle.buildServer.enabled). (#1497)

The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

github-actions[bot] avatar Nov 05 '25 13:11 github-actions[bot]