For VS Code how to provide models like the BuildEnvironment locally to Gradle?

I have Gradle and the Gradle VS Code extension installed on a Linux machine without internet. I had to tell the VS Code extension to use the installed Gradle (and not try to download it again!), but now the extension finds my local Gradle install. So far so good.

However, as soon as the VS Code extension wants to do something (like finding my tasks) it errors out with:

[gradle-server] Could not fetch model of type ‘BuildEnvironment’ using connection to Gradle installation /path/to/gradle/install/bin/gradle

So somehow I have to provide the BuildEnvironment model to the local gradle(-server). How do I do this? Where does Gradle stores these models locally on the machine? And from where can I download them (on another internet-connected machine of course)?

Thanks for any pointers!

My recommendation would be to use a proper IDE like IntelliJ IDEA instead of a fancy text editor like VSC. That model is nothing you can provide or is stored somewhere. It is an object that the VSC extension want to get from the actual build that provides information about the build. But from that single line it is totally unclear to me what the problem might be.

1 Like

Thanks for your reply. I very much appreciate that you help me out!

Yep, VSC is pretty basic, but IntelliJ is not available in my environment. And the reason I use Gradle in the first place is, that VSC cannot handle building of WAR files by itself. It needs a build tool.

So VSC is downloading the model, not Gradle? And the model "BuildEnvironment "
is not Gradle thing at all?

Yep, VSC is pretty basic, but IntelliJ is not available in my environment. And the reason I use Gradle in the first place is, that VSC cannot handle building of WAR files by itself. It needs a build tool.

You should imho always use a proper build tool, no matter which IDE you use. :slight_smile:

So VSC is downloading the model, not Gradle? And the model "BuildEnvironment "
is not Gradle thing at all?

Again, it is nothing that is “downloaded”. And it is the Gradle-integration for VSC, whether it is built-in or some plugin / extension I don’t know, I don’t use VSC. The Gradle-integration uses the Gradle tooling API to talk to the Gradle daemon and ask it about the model of the build like dependencies, available tasks, source directories and so on. And this seems to somehow not work properly. I’d recommend you ask the developer of that Gradle integration about your problem.

If it is this you use: Gradle for Java - Visual Studio Marketplace, I guess you should report your issue at Issues · microsoft/vscode-gradle · GitHub.

Thanks for the suggestion. Done: Issue #1304 - microsoft/vscode-gradle