Gradle wrapper does not follow redirects

I just tried building Apache Kafka project, trunk branch. It has Gradle wrapper configured to fetch Gradle 1.6 from


Build fails with following exception:

C:\Users\foo\Documents\GitHub\kafka> .\gradlew jarAll Downloading

Unzipping C:\Users\foo.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\ to C:\Users\foo.gradle\wrapper\dist s\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok Exception in thread “main” java.lang.RuntimeException: error in opening zip file

at org.gradle.wrapper.ExclusiveFileAccessManager.access(

at org.gradle.wrapper.Install.createDist(

at org.gradle.wrapper.WrapperExecutor.execute(

at org.gradle.wrapper.GradleWrapperMain.main( Caused by: error in opening zip file

at Method)




at org.gradle.wrapper.Install.unzip(

at org.gradle.wrapper.Install.access$400(

at org.gradle.wrapper.Install$

at org.gradle.wrapper.Install$

at org.gradle.wrapper.ExclusiveFileAccessManager.access(

… 3 more

When I opened Gradle distribution zip file, that wrapper has downloaded, in a text editor, I got following:

301 Moved Permanently

Moved Permanently

The document has moved here.

Apache/2.2.3 (CentOS) Server at Port 80

It seems host has changed for distribution archives, permanent redirect was configured for old location, but wrapper doesn’t seem to follow redirects.

Same issue occurred when I installed Gradle wrapper 1.10 and 1.11, using first matching Gradle version URL, and then 1.6 URL, failing in each and every case.

Only when changing wrapper configuration to use distributionUrl= it started working again.

Please consider rising JIRA ticket for Gradle wrapper for this.

Same issue here, with gradle wrapper 1.9… It worked in the morning, but broke like 2 hours ago.

Same issue with 1.11

same for 1.10

[root@ci-cent5-001 ~]# curl 301 Moved Permanently

Moved Permanently

The document has moved here.

Apache/2.2.3 (CentOS) Server at Port 443

[root@ci-cent5-001 ~]# wget --2014-04-10 11:00:42-- Resolving…,,, … Connecting to||:80… connected. HTTP request sent, awaiting response… 200 OK Length: 40055092 (38M) [application/zip] Saving to: ‘’

100%[===========================================================================================================================================================>] 40,055,092 9.11M/s

in 4.1s

2014-04-10 11:00:46 (9.36 MB/s) - ‘’ saved [40055092/40055092]


------------- distributionUrl=

instead: distributionUrl=

It helps if you cache it as part of your artifactory repos:

Gradleware is aware and working on this.

Should be back to normal.

The change was the we enabled https for wrapper downloads. For some reason that I don’t understand yet, some environments don’t deal with this well while others do.

FWIW, every wrapper request already involved redirects. It’s something more subtle.

If I could ask a favour…

Can you please try updating your ‘gradle/wrapper/’ to use the ‘’ URL.

You’ll have to do this:

  1. Kill all daemon processes 1. Remove the existing wrapper ‘rm -rf ~/.gradle/wrapper/dists/gradle-1.11-bin’ 1. Run ‘./gradlew’ build

If it doesn’t work, please post the Gradle output.


It works now: ’ d:\Workspaces\JavaDevelopment\1.5.3>gradlew clean compileJava --debug ’


Unzipping C:\Users\victorm.gradle\wrapper\dists\gradle-1.10-bin\4q0bb2i9nap9j7pt8jgurkeb68\gradle- to C:\Users\victorm.gradle\wrapper\dists\gradle-1.10-bin\4q0bb2i9nap9j7pt8jgurkeb68

11:30:47.610 [INFO] [org.gradle.BuildLogger] Starting Build

11:30:47.616 [DEBUG] [org.gradle.BuildLogger] Gradle user home: C:\Users\victorm.gradle

works for me using both and


IMO wrapper should be fixed to handle redirects, even if http services URLs started working again.

distributionUrl is generated by the wrapper task. If it should generate URL with https instead of http, I guess then also wrapper task needs to be fixed.

The wrapper does follow redirects. The URL that it has used since Gradle 1.1 results in a redirect. is used to download the wrapper. On some JDKs this seems to have a problem with a redirect that switches protocols. That was the new bit yesterday.

Generated wrapper URLs will use https as of Gradle 1.12.

Services URL works with http and https for me now.