Gradlew Wrapper task is unable to download m8

I have this task:

task createWrapper(type: Wrapper) {
    gradleVersion = '1.0-milestone-8'
}

After I run it, I get the normal gradlew files, but the URL for the distribution is pointing a location which doesn’t exists and I get this error:

Downloading http://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-8-bin.zip
  Exception in thread "main" java.io.FileNotFoundException: http://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-8-bin.zip
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434)
 at org.gradle.wrapper.Download.downloadInternal(Download.java:49)
 at org.gradle.wrapper.Download.download(Download.java:37)
 at org.gradle.wrapper.Install.createDist(Install.java:58)
 at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:117)
 at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:53)

It looks like services.gradle.org/distributions is the new location, but the Wrapper task has repo.gradle.org hardcoded. I’m not sure if services.gradle.org is the right URL, but it’d sure be nice is the gradle-1.0-milestone-8-bin.zip was moved to repo.gradle.org

I should also mention that this breaks my Artifactory proxy/caching repository, which is configured for repo.gradle.org.

The simplest solution is to edit gradle-wrapper.properties and point it to the new URL.

You can change your proxy configuration to point to:

http://services.gradle.org/distributions

So there are a couple of ways to fix this:

Update ‘gradle/gradle-wrapper.properties’ to have this entry:

distributionUrl=http://services.gradle.org/distributions/gradle-1.0-milestone-8-bin.zip

Or you can change your wrapper task definition to look like this:

task wrapper(type: Wrapper) {

distributionUrl = “http://services.gradle.org/distributions/gradle-1.0-milestone-8-bin.zip” }

it looks like the distributions have moved yet again. all the artifacts at the http://services… url are redirect html files. Your browser will know how to navigate that redirect but unfortunately curl -O doesn’t. Perhaps there is another flag that will make curl smarter. But the new url looks to be:

http://downloads.gradle.org/distributions/

The service.gradle.org URLs have always been redirects. Were you previously using the services.gradle.org URLs without the -O flag?

no but my gradle wrapper task was unable to follow the redirect and just downloded a ~300B html file instead of a 32M zip which gradlew was then unable to use:

[08:57]~/workspace/gc/rsp/rs (svn::/UI/RS/trunk)$ gradlew -v Unzipping /Users/mholm/.gradle/wrapper/dists/gradle-1.1-bin.zip to /Users/mholm/.gradle/wrapper/dists Exception in thread “main” java.util.zip.ZipException: error in opening zip file

at java.util.zip.ZipFile.open(Native Method)

at java.util.zip.ZipFile.(ZipFile.java:127)

at java.util.zip.ZipFile.(ZipFile.java:143)

at org.gradle.wrapper.Install.unzip(Install.java:138)

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

at org.gradle.wrapper.Wrapper.execute(Wrapper.java:45)

at org.gradle.wrapper.WrapperMain.main(WrapperMain.java:39)

So I downloaded the zip from the redirect URL, put it in the wrapper/dists dir, and though I am still getting an error, it is a different one leading me to believe that I am further along :slight_smile:

I’m not sure what’s happened here. The wrapper definitely follows redirects, and the redirect page does not server HTML. Any chance you can post what was in the HTML file?

<table border='0' cellpadding='0' cellspacing='0' width='100%'

style=‘font-family: Arial,Helvetica,sans-serif;font-size:12px;padding-left: 10px;’>

 
<img id='headerimage' name='headerimage'

src=‘http://10.18.84.1:8090/images/customizeimages/default/defpageHeader.gif

onload=‘callToSetImageSize(this)’ style=‘visibility:hidden’>



Dear <font

class=accessdeniedcategoryfont>{user},

This is a

message from the IT Department.

The web site you are trying to access:
<font

class=accessdeniedcategoryfont>{url}
is listed as a

site within the category {category}

<font

class=accessdeniedtextfont> Current Internet Access Configuration does not allow you to visit

sites within this category at this time.


<img id='footerimage' name='footerimage'

src=‘http://10.18.84.1:8090/images/customizeimages/default/defpageFooter.jpg

onload=‘callToSetImageSize(this)’ style=‘visibility:hidden’>

well…that didn’t work great…is there a way to post html without it getting interpreted?

You’d have to HTML encode it (http://opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx).

This means that your corporate firewall intercepted the request and blocked it. This isn’t a page that we serve.

well that’s a bummer… thanks for the help. guess i’ll get the zip with curl and put it in scm in case they move again.

here’s the encoded html btw:

<html> <head>

<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>

<title></title>

<script type='text/javascript'>function setImageSize() {

var ele1 = document.getElementById('headerimage');

var ele2 = document.getElementById('footerimage');

setHeightWidth(ele1);

setHeightWidth(ele2);

}

function setHeightWidth(ele) {

var h = ele.offsetHeight;

var w = ele.offsetWidth;

if (ele.offsetWidth > 700) {

ele.width = 700;

} else {

ele.width = w;

}

if (ele.offsetHeight > 80) {

ele.height = 80;

} else {

ele.height = h;

}

}</script> </head> <body onload='setImageSize()' leftmargin='0' topmargin='0' marginheight='0' marginwidth='0'> <form name='previewform'>

<table border='0' cellpadding='0' cellspacing='0' width='100%'

style='font-family: Arial,Helvetica,sans-serif;font-size:12px;padding-left: 10px;'>

<tr>

<td align='center'>&nbsp;<br/><img id='headerimage' name='headerimage'

src='http://10.18.84.1:8090/images/customizeimages/default/defpageHeader.gif'

onload='callToSetImageSize(this)' style='visibility:hidden'></img></td>

</tr>

<tr>

<td align='left'><br>

<div id='message'><font class=accessdeniedtextfont><b><BR>Dear </font><font

class=accessdeniedcategoryfont>{user},</font><BR><BR><font class=accessdeniedtextfont>This is a

message from the IT Department. <BR><BR>The web site you are trying to access: <BR></font><font

class=accessdeniedcategoryfont>{url}</font><BR><font class=accessdeniedtextfont>is listed as a

site within the category </font><font class=accessdeniedcategoryfont>{category}</font><BR><BR><font

class=accessdeniedtextfont> Current Internet Access Configuration does not allow you to visit

sites within this category at this time.<BR></font></div>

<br></td>

</tr>

<tr>

<td align='center'><img id='footerimage' name='footerimage'

src='http://10.18.84.1:8090/images/customizeimages/default/defpageFooter.jpg'

onload='callToSetImageSize(this)' style='visibility:hidden'></img></td>

</tr>

</table> </form> </body> <script language="JavaScript"> var heightVar, widthVar, timeoutInterval = 50; function setHeightWidth() {

var diff, reducePer, tempVar;

if (widthVar > 700) {

diff = widthVar - 700;

reducePer = 100 * diff / widthVar;

tempVar = reducePer * widthVar / 100;

widthVar = widthVar - tempVar;

tempVar = reducePer * heightVar / 100;

heightVar = heightVar - tempVar;

}

if (heightVar > 80) {

diff = heightVar - 80;

reducePer = 100 * diff / heightVar;

tempVar = reducePer * heightVar / 100;

heightVar = heightVar - tempVar;

tempVar = reducePer * widthVar / 100;

widthVar = widthVar - tempVar;

} } function setImageSize(imgName) {

if (document.getElementById(imgName) && document.getElementById(imgName).offsetWidth != 0 && document.getElementById(imgName).offsetHeight != 0) {

widthVar = document.getElementById(imgName).offsetWidth;

heightVar = document.getElementById(imgName).offsetHeight;

setHeightWidth();

document.getElementById(imgName).width = widthVar;

document.getElementById(imgName).height = heightVar;

document.getElementById(imgName).style.visibility = '';

} else {

setTimeout('setImageSize()', timeoutInterval);

} } function callToSetImageSize(obj) {

if (navigator.appName.indexOf("Opera") != -1) {

timeoutInterval = 350;

}

setTimeout('setImageSize("' + obj.name + '")', timeoutInterval); } </script> </html>