I seems impossible to automate the gradle download with curl on bash where release_number
can take different values:
curl --location --show-error -O --url "https://gradle.org/next-steps/?version=${release_number}&format=all"
downloads a text file:
<!DOCTYPE html>
<html lang="en-US" class="site-layout" itemscope itemtype="https://schema.org/WebPage">
<head prefix="og: http://ogp.me/ns#
website: http://ogp.me/ns/website#
">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gradle | Thank you for downloading Gradle!</title>
<script src="/cdn-cgi/apps/head/zmmHCWWiIZ8eWNXY8w-TWeCQJEI.js"></script><link crossorigin href="//assets.gradle.com" rel="preconnect">
<style type="text/css">/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */
html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:mon
ospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:
bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bott
om:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visibl
e}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,
[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,bu
tton:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white
-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[
type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearanc
e:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}</styl
e>
...
Any suggestion?
I just tried this command in an MSYS2 MinGW 64 bit shell a minute ago :
$ curl -k -L -v -X GET https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip > gradle-5.4.1-bin.zip
Note: Unnecessary use of -X or --request, GET is already inferred.
* Expire in 0 ms for 6 (transfer 0x324400)
* Expire in 1 ms for 1 (transfer 0x324400)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Expire in 0 ms for 1 (transfer 0x324400)
* Expire in 1 ms for 1 (transfer 0x324400)
* Expire in 0 ms for 1 (transfer 0x324400)
* Expire in 0 ms for 1 (transfer 0x324400)
....
* Expire in 1 ms for 1 (transfer 0x324400)
* Expire in 1 ms for 1 (transfer 0x324400)
* Expire in 1 ms for 1 (transfer 0x324400)
* Trying 104.18.190.9...
* TCP_NODELAY set
* Expire in 149998 ms for 3 (transfer 0x324400)
* Expire in 200 ms for 4 (transfer 0x324400)
* Connected to downloads.gradle.org (104.18.190.9) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: L:/ingocoder/Git/mingw64/ssl/certs/ca-bundle.crt
CApath: none
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [106 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [2166 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [116 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=US; ST=CA; L=San Francisco; O=CloudFlare, Inc.; CN=gradle.org
* start date: Jan 25 00:00:00 2019 GMT
* expire date: Jan 25 12:00:00 2020 GMT
* issuer: C=US; ST=CA; L=San Francisco; O=CloudFlare, Inc.; CN=CloudFlare Inc ECC CA-2
* SSL certificate verify ok.
} [5 bytes data]
> GET /distributions/gradle-5.4.1-bin.zip HTTP/1.1
> Host: downloads.gradle.org
> User-Agent: curl/7.64.0
> Accept: */*
>
{ [5 bytes data]
< HTTP/1.1 200 OK
< Date: Mon, 03 Jun 2019 12:08:41 PDT
< Content-Type: application/zip
< Content-Length: 87107055
< Connection: keep-alive
< Set-Cookie: __cfduid=db9d9c61ca7ef48c8a7ed390bf266a88c1559588921; expires=Tue, 02-Jun-20 12:08:41 PDT; path=/; domain=.gradle.org; HttpOnly
< Last-Modified: Fri, 26 Apr 2019 08:28:00 GMT
< ETag: "3c582aeb2cd7a829a1bd7174d12c1971"
< x-amz-meta-gradle-release-date: 20190426081442+0000
< x-amz-meta-md5-hash: 3c582aeb2cd7a829a1bd7174d12c1971
< X-Cache: Miss from cloudfront
< Via: 1.1 b052e5b910437a7391e6af4158f04edb.cloudfront.net (CloudFront)
< X-Amz-Cf-Id: 9MuFb8o9GxkGuUVzY1yl-8IIAjt28T9TNqLgRX3dTabphY7spKcooA==
< CF-Cache-Status: HIT
< Expires: Tue, 02 Jun 2020 12:08:41 PDT
< Cache-Control: public, max-age=31536000
< Accept-Ranges: bytes
< Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< Server: cloudflare
< CF-RAY: 4e13f5067e377fc6-SAN
<
{ [447 bytes data]
100 83.0M 100 83.0M 0 0 247k 0 0:05:44 0:05:44 --:--:-- 278k
It seems to have made it down intact:
$ jar -tvf gradle-5.4.1-bin.zip
...
6455 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/media/gradle-icon-64x64.png
241431 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/media/gradle.icns
0 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/bin/
5908 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/bin/gradle
2933 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/bin/gradle.bat
0 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/
868 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/gradle-api-metadata-5.4.1.jar
498366 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/gradle-launcher-5.4.1.jar
3396 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/gradle-runtime-api-info-5.4.1.jar
370352 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/gradle-tooling-api-5.4.1.jar
28725 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/gradle-wrapper-5.4.1.jar
...
326356 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/httpcore-4.4.10.jar
69254 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/jcommander-1.72.jar
71976 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/jzlib-1.1.3.jar
52087 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/maven-artifact-3.0.4.jar
150593 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/maven-model-builder-3.0.4.jar
163553 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/maven-model-3.0.4.jar
30077 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/maven-repository-metadata-3.0.4.jar
41378 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/maven-settings-builder-3.0.4.jar
46665 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/maven-settings-3.0.4.jar
28555 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/plexus-sec-dispatcher-1.3.jar
13350 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/plexus-cipher-1.7.jar
49793 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/plexus-classworlds-2.5.1.jar
4211 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/plexus-component-annotations-1.5.5.jar
61072 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/plexus-interpolation-1.14.jar
55258 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/wagon-provider-api-3.0.0.jar
261617 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/plexus-utils-3.1.0.jar
148098 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/xbean-reflect-3.7.jar
565410 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/ion-java-1.0.2.jar
135012 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/junit-platform-engine-1.3.1.jar
77857 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/junit-platform-commons-1.3.1.jar
2164 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/apiguardian-api-1.0.0.jar
7121 Fri Feb 01 00:00:00 GMT 1980 gradle-5.4.1/lib/plugins/opentest4j-1.1.1.jar
...
Thanks, the URL makes the difference:
curl --location --show-error -O --url "https://services.gradle.org/distributions/gradle-${release_number}-all.zip"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 126M 100 126M 0 0 101M 0 0:00:01 0:00:01 --:--:-- 109M
downloads the correct zip file.
1 Like