在Spring.io REST教程中构建错误

时间:2014-01-17 21:10:15

标签: java spring rest gradle

我正在尝试执行Spring REST教程,并且在使用本教程中推荐的gradle构建工具时遇到了这些构建错误。

https://spring.io/guides/gs/rest-service/

感谢您的帮助

C:\Users\Desktop\gs-rest-service-master\gs-rest-service-master\initial>
gradlew build
Downloading http://services.gradle.org/distributions/gradle-1.8-bin.zip

Exception in thread "main" java.lang.RuntimeException: java.net.UnknownHostExcep
tion: services.gradle.org
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.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:61)
Caused by: java.net.UnknownHostException: services.gradle.org
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:178)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at java.net.Socket.connect(Socket.java:528)
        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.http.HttpClient.<init>(HttpClient.java:211)
        at sun.net.www.http.HttpClient.New(HttpClient.java:308)
        at sun.net.www.http.HttpClient.New(HttpClient.java:326)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:996)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:932)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:850)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1300)
        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(ExclusiveFileAcc
essManager.java:65)
        ... 3 more

2 个答案:

答案 0 :(得分:2)

错误消息不言自明。您的DNS无法正常运行。 services.gradle.org在我的计算机上正确解析。

答案 1 :(得分:1)

通过设置我的代理设置解决了该问题。

创建了一个名为gradle.properties的文件:

systemProp.http.proxyHost=my.prox.com
systemProp.http.proxyPort=12

http://www.gradle.org/docs/current/userguide/build_environment.html