我正在关注这个 grpc 教程,但我什至无法完成第一步。第一步是 git clone 项目然后运行
cd examples
./gradlew installDist
我被这个堆栈跟踪击中
Downloading https://services.gradle.org/distributions/gradle-2.13-bin.zip
Exception in thread "main" java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:61)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
我认为这是一个代理问题,所以我从这篇文章中获得了一些灵感并打开了文件
gradle/wrapper/gradle-wrapper.properties
并添加了线条
systemProp.http.proxyHost=<my proxy>
systemProp.http.proxyPort=<my port>
我也用这个替换了 distributionUrl 行
distributionUrl=http\://services.gradle.org/distributions/gradle-2.13-bin.zip
也就是说,我切换了 https --> http。
毕竟,我仍然得到相同的堆栈跟踪。
有人有建议吗?
编辑:我添加了一个
gradle.properties
主目录中的文件,并添加字段
systemProp.http.proxyHost
systemProd.http.proxyPort
和
systemProp.https.proxyHost
systemProp.https.proxyPort
但我仍然遇到与以前相同的错误。但是,构建脚本似乎停在这一行
Downloading https://services.gradle.org/distributions/gradle-2.13-bin.zip
大约 10 秒左右,在失败之前。所以……进步?