502 error from Gradle Wrapper downloading from Artifactory

I’m having trouble getting Gradle wrapper to download the -bin.zip file from an Artifactory instance. I’d like to distribute my corporate-modified (added init scripts) version of Gradle via our Artifactory artifact manager, but receive a 502 error from the Artifactory server. Unfortuantely, the Artifactory server has nothing useful in its logs for this request. I have validated that my browser can successfully and fully download the file http://testlab3:8081/artifactory/simple/ext-release-local/gradle/gradle/1.4/gradle-1.4-bin.zip if I enter it into the location bar.

Here’s the relevant closure:

task wrapper(type: Wrapper) {

distributionUrl = ‘http://testlab3:8081/artifactory/simple/ext-release-local/gradle/gradle/1.4/gradle-1.4-bin.zip’ }

Then I execute

$gradle wrapper

And here’s the trace I’m getting when I try to use the wrapper:

c:\Development\Intellij\projectName>gradlew tasks Downloading http://testlab3:8081/artifactory/simple/ext-release-local/gradle/g radle/1.4/gradle-1.4-bin.zip

Exception in thread “main” java.io.IOException: Server returned HTTP response co de: 502 for URL: http://testlab3:8081/artifactory/simple/ext-release-local/gra dle/gradle/1.4/gradle-1.4-bin.zip

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1612)

at org.gradle.wrapper.Download.downloadInternal(Download.java:63)

at org.gradle.wrapper.Download.download(Download.java:49)

at org.gradle.wrapper.Install.createDist(Install.java:51)

at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)

at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

Anyone have suggestions?

Looks like you need to configure your proxy settings for the Gradle wrapper. Try putting this into ‘~/.gradle/gradle-wrapper.properties’.


Thank you! :slight_smile:

It was actually the reverse of this situation, Gradle was trying to use the proxy to access a local resource.

I added the following line:


to my ~/.gradle/gradle-wrapper.properties and got it fixed.