gradle java.net.SocketException: Unexpected end of file from server
原创./gradlew build --stacktrace --debug
Downloading https://services.gradle.org/distributions/gradle-4.10.1-all.zip
Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Unexpected end of file from server
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2055)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
at org.gradle.wrapper.Download.download(Download.java:45)
at org.gradle.wrapper.Install$1.call(Install.java:60)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
... 3 more
很奇怪,url正确,用chrome也能下载。网络看着也ok。
curl看下:
curl -v https://services.gradle.org/distributions/gradle-4.10.1-all.zip
* Trying 104.18.190.9...
* TCP_NODELAY set
* Connected to services.gradle.org (104.18.190.9) port 443 (#0)
> GET /distributions/gradle-4.10.1-all.zip HTTP/1.1
> Host: services.gradle.org
> User-Agent: curl/7.64.1
> Accept: */*
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 16 Dec 2020 09:57:07 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: max-age=3600
< Expires: Wed, 16 Dec 2020 10:57:07 GMT
< Location: https://downloads.gradle-dn.com/distributions/gradle-4.10.1-all.zip
< cf-request-id: 070c9478c50000258d9ea59000000001
< Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload