Frustrated again with "Could not install Gradle distribution from ..." behind proxy

I haven’t been looking at my gradle build for a while. I’m on Win7, using Gradle 2.4, Groovy 2.3.10, and Java 7. I work behind a non-authenticated proxy. All my proxy settings are set correctly in my environment, including wget and curl. In my ~/.gradle/wrapper/dists folder, I have several versions of Gradle, including 2.2, 2.2.1, 2.3, and 2.4.

When I try to run my build, it fails with errors like this:

    09:36:39.798 [DEBUG] [TestEventLogger]     Downloading https://services.gradle.org/distributions/gradle-2.4-bin.zip
...
09:37:00.204 [DEBUG] [TestEventLogger]         Caused by:
09:37:00.204 [DEBUG] [TestEventLogger]         org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.4-bin.zip'.
...
09:37:00.207 [DEBUG] [TestEventLogger]             Caused by:
09:37:00.207 [DEBUG] [TestEventLogger]             java.net.ConnectException: Connection timed out: connect

I’ve run into this before, and I believe it simply required running this from outside of the proxy, and once it succeeds once, I don’t have to do it again.

I have no trouble getting to this url from wget, curl, or my browser.

I guess there are two issues here. First, Gradle is obviously failing to connect to the internet, most likely because it’s not properly integrating proxy information. Second, I’m not sure WHY it’s trying to download the Gradle 2.4 distribution. It’s already in my wrapper dists, and it’s obviously in my PATH (although I’m sure that last part is irrelevant).

The %PATH% variable is irrelevant. regarding the redownload. Have you changed your GRADLE_HOME directory? You should be able to configure your proxy as explained in the Gradle userguide at https://docs.gradle.org/current/userguide/userguide_single.html#sec:accessing_the_web_via_a_proxy.

I set my GRADLE_HOME to point to Gradle 2.4 a while ago. My proxy settings have been in ~/.gradle/gradle.properties for a long time. I haven’t had any trouble downloading dependencies. It’s only this Gradle distribution download that fails.

Note that I’m only setting the host and port properties. It’s unauthenticated, and I didn’t bother to set nonProxyHosts.

sorry I meant GRADLE_USER_HOME and not GRADLE_HOME

I’ve never set GRADLE_USER_HOME. I assume it uses a default of “~/.gradle”?

Never mind. I have a short memory. The last time this happened, I finally realized this was a problem with the nebula-test plugin. I’ll just update the issue I filed the first time.

Hi David,

I am facing same issue here, can you tell the solution what you have done to resolving this issue.

Issue: Gradle connection Exception: could not install Gradle 2.4 distribution from gradle-2.14-bin.zip file

Please find attached error screenshot

Please help me here

Lo solucionaste?
tengo el mismo problema, por favor help me

Hola yo encontre por fin la solucion

mira este link https://stackoverflow.com/a/36896997/4677155

Al final no hace nada mas y nada menos que

org.gradle.daemon=true
systemProp.https.proxyHost=proxy.company.net
systemProp.https.proxyPort=8181
systemProp.http.proxyHost=proxy.company.net
systemProp.http.proxyPort=8181
systemProp.https.nonProxyHosts=*.company.com|localhost

dentro del file gradle.properties de tu projecto

Just set the corresponding updated gradle repository URL in the gradle-wrapper.properties file from https://services.gradle.org/distributions/.