Add Gradle Nature, how to specify local gradle installation?


(Pooja Daryani) #1

Using Buildship eclipse plugin, if I try to add gradle nature to my existing java project, it tries to go to internet and because of firewalls, I get
Could not install Gradle distribution from ‘https://services.gradle.org/distributions/gradle-2.14.1-bin.zip’.

So, I want to use my local gradle installation. But I did not find a place to change when adding gradle nature to existing project using buildship plugin. Is it possible? Would appreciate any feedback.

As a workaround, I was able to successfully specify local gradle installation in Gradle(STS) preferences, convert to Gradle(STS) Project, and then import using Buildship Gradle,


(Stefan Oehme) #2

Please use the Gradle wrapper and point it to a Gradle distribution that is accessible behind your firewall, e.g. a company mirror.

You can also reimport the project with the Gradle import wizard and specify a local installation there, but I strongly recommend using the wrapper.


(Pooja Daryani) #3

Thanks! But it doesn’t seem to work. I updated distributionURL to following in graddle-wrapper.properties.
distributionUrl=file:/c:/gradle-2.14.1/gradle-2.14.1-all.zip

After this change, when I try to Add Gradle Nature to my existing project, I still get the same error
Could not install Gradle distribution from ‘https://services.gradle.org/distributions/gradle-2.14.1-bin.zip’.


(Stefan Oehme) #4

I think you placed the wrapper properties in the wrong directory and gave it the wrong name. It’s gradle/wrapper/gradle-wrapper.properties. You can run the gradle wrapper task to generate it for you.


(Pooja Daryani) #5

It seems in the correct location. I ran graddle wrapper task from command prompt. gradle-wrapper.properties was created in C:\Users\my user name\gradle\wrapper. After updating distributionURL, ths contents looks like following

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file:/c:/gradle-2.14.1/gradle-2.14.1-all.zip

Where GRADLE_USER_HOME is set to C:\Users\my user name\ .gradle

I restarted my eclipse and tried Configure -> Add Gradle Nature. I still get the same error


(Stefan Oehme) #6

The Gradle wrapper does not go in your user home, it goes into your project. Please have a look at the documentation.


(Pooja Daryani) #7

ahh, that’s the trick. Thanks! it worked when I changed gradle-wrapper.properties in my project.