How to stop Gradle projects set up with gradle init to download stuff

I have a few “hand written” scripts and they work as expected on my air gapped machine.

However, when I create Gradle setups with gradle init they always want to download the Gradle stuff again! That of course fails on my machine without internet.

How can I tell these standard setups not to download gradle again. I have it lready in my path.

This is a recurring issue on the command line, in VS Code and now in Intellij (Intellij is suppose to have everything build-in, but Gradle still tries to download its stuff again.)

Any pointer is much appreciated.

It is hard to guess what is different between project you do not show 1 and project you do not show 2.
Maybe just compare them?
If what you mean is the Gradle distribution itself and in your other project you do not have the 4 Gradle wrapper files, then just delete those.
But actually, imho each build that does not have the 4 wrapper files has a build bug.
But as long as those projects are just for you personally and you make sure manually to only run them with the correct Gradle version manually, you should be fine. Either delete the wrapper files, or configure your tools like IJ and VSC to not use the version defined in the wrapper but some arbitrary version you define.

Alternatively, add the Gradle distributions to the expected place in your air-gapped machine where the wrapper expects them to be.

1 Like

Thanks a lot for chiming in and sorry, that I was a short-spoken in my post.

Yes that’s one difference: When I generate an official project with gradle init it has teh following addtional items:

./gradle (diretory)
./gradlew.bat (file)

So I can either delete them or:

That’s probably the better way. :smile: How do I find out where my machine expects the Gradle distribution (and other things like the foojay-resolver plugin). I’m on CentOS Linux.

Yes, those four are the Gradle wrapper files.
gradlew, gradlew.bat, gradle/wrapper/gradle-wrapper.jar, and gradle/wrapper/
The defines which Gradle version should be used for the given build and also where the auto-provisioned distribution is to be stored.
The distributions are by default in <GRADLE_USER_HOME>/wrapper/dists/ which by default is in ~/.gradle/wrapper/dists/.
The foojay-resolver plugin is looke for in the <GRADLE_USER_HOME>/caches/modules-2/files-2.1/ like any other dependency or plugin.

1 Like