Gradle extension should start to synchronize project after `redhat.java` is ready
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.
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 runninggetBuild():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.enabledsetting so that synchronization only happens when enabled. (#1290)
Other references with low confidence
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!