尽管路径正确,但无法使用 Grails
Can't use Grails despite correct paths
我正在尝试在工作时在我的计算机上设置 Grails 运行ning Windows 10,但我无法这样做。我已经从网站 (3.3.8) 下载了最新版本,在我的帐户中添加了一个 GRAILS_HOME 变量,指向解压缩的 Grails 目录,并将其 bin 子目录的路径添加到系统路径,而 grails -v
工作并输出 Grails 的版本,Gradle 和 Java 正确,基本上没有其他命令。
当我尝试使用 grails create-app someApp
创建一些示例应用程序时,我得到 | Error Error initializing classpath: services.gradle.org
和这样的跟踪:
| Resolving Dependencies. Please wait...
Downloading https://services.gradle.org/distributions/gradle-3.5-bin.zip
| Error Error initializing classpath: services.gradle.org
java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
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:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
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:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
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:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.tooling.internal.consumer.DistributionFactory$ProgressReportingDownload.download(DistributionFactory.java:201)
at org.gradle.wrapper.Install.call(Install.java:61)
at org.gradle.wrapper.Install.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.tooling.internal.consumer.DistributionFactory$ZippedDistribution.call(DistributionFactory.java:138)
at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.call(DistributionFactory.java:132)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
| Error Error initializing classpath: services.gradle.org
类似地,当我尝试下载一个项目(比如从 start.grails.org 生成的项目)并且只是 运行 在本地使用 grailsw run-app
时,我得到:
You must be connected to the internet the first time you use the Grails wrapper
java.net.UnknownHostException: repo.grails.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at java.net.URL.openStream(URL.java:1045)
at grails.init.Start.getVersion(Start.java:36)
at grails.init.Start.main(Start.java:83)
即使是简单的帮助命令也不起作用,因为 grails -help
输出 | Error Error occurred running Grails CLI: repo.grails.org
这可能是什么原因?公司防火墙是否阻止了某些东西?我怎样才能完成这项工作?
您提到了公司代理;您可以在 gradle.properties 中这样设置您的代理:
systemProp.https.proxyHost=<your proxy>
systemProp.https.proxyPort=<your port>
systemProp.http.proxyHost=<probably same>
systemProp.http.proxyPort=<probably same>
systemProp.http.nonProxyHosts:<optional. comma-separated. probably at least want localhost in there: *.domain.com,localhost>
我正在尝试在工作时在我的计算机上设置 Grails 运行ning Windows 10,但我无法这样做。我已经从网站 (3.3.8) 下载了最新版本,在我的帐户中添加了一个 GRAILS_HOME 变量,指向解压缩的 Grails 目录,并将其 bin 子目录的路径添加到系统路径,而 grails -v
工作并输出 Grails 的版本,Gradle 和 Java 正确,基本上没有其他命令。
当我尝试使用 grails create-app someApp
创建一些示例应用程序时,我得到 | Error Error initializing classpath: services.gradle.org
和这样的跟踪:
| Resolving Dependencies. Please wait...
Downloading https://services.gradle.org/distributions/gradle-3.5-bin.zip
| Error Error initializing classpath: services.gradle.org
java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
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:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
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:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
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:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.tooling.internal.consumer.DistributionFactory$ProgressReportingDownload.download(DistributionFactory.java:201)
at org.gradle.wrapper.Install.call(Install.java:61)
at org.gradle.wrapper.Install.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.tooling.internal.consumer.DistributionFactory$ZippedDistribution.call(DistributionFactory.java:138)
at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.call(DistributionFactory.java:132)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
| Error Error initializing classpath: services.gradle.org
类似地,当我尝试下载一个项目(比如从 start.grails.org 生成的项目)并且只是 运行 在本地使用 grailsw run-app
时,我得到:
You must be connected to the internet the first time you use the Grails wrapper
java.net.UnknownHostException: repo.grails.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at java.net.URL.openStream(URL.java:1045)
at grails.init.Start.getVersion(Start.java:36)
at grails.init.Start.main(Start.java:83)
即使是简单的帮助命令也不起作用,因为 grails -help
输出 | Error Error occurred running Grails CLI: repo.grails.org
这可能是什么原因?公司防火墙是否阻止了某些东西?我怎样才能完成这项工作?
您提到了公司代理;您可以在 gradle.properties 中这样设置您的代理:
systemProp.https.proxyHost=<your proxy>
systemProp.https.proxyPort=<your port>
systemProp.http.proxyHost=<probably same>
systemProp.http.proxyPort=<probably same>
systemProp.http.nonProxyHosts:<optional. comma-separated. probably at least want localhost in there: *.domain.com,localhost>