grails 3.0.1代理设置

时间:2015-04-20 06:34:18

标签: grails proxy

我是Grails 3.0.1的新手,并想知道如何以及在何处设置正确的代理设置。我知道我的代理配置是什么 - IP和端口,但不知道放在哪里。 当我在helloworld项目中尝试运行grails命令时,我收到类似这样的错误:

ivo@ivotrisquel:~/grails/projects/helloworld$ grails --stacktrace
| Error Problem updating profiles from origin git repository (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.eclipse.jgit.api.errors.TransportException: https://github.com/grails/grails-profile-repository: cannot open git-upload-pack
    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
    at org.grails.cli.profile.git.GitProfileRepository.fetchAndRebaseIfExpired(GitProfileRepository.groovy:140)
    at org.grails.cli.profile.git.GitProfileRepository.createOrUpdateRepository(GitProfileRepository.groovy:109)
    at org.grails.cli.profile.git.GitProfileRepository.getProfile(GitProfileRepository.groovy:56)
    at org.grails.cli.GrailsCli.initializeProfile(GrailsCli.groovy:347)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:192)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:99)
Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/grails/grails-profile-repository: cannot open git-upload-pack
    at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:524)
    at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:309)
    at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
    at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
    at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1115)
    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
    ... 6 more
Caused by: java.net.ConnectException: Connection timed out github.com
    at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:175)
    at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:475)
    ... 11 more
| Error Problem updating profiles from origin git repository

5 个答案:

答案 0 :(得分:12)

我遇到了同样的问题并解决了它以下列方式将代理配置添加到GRAILS_HOME / bin / grails.bat文件中:

>set GRAILS_OPTS=%GRAILS_OPTS% -Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort -Dhttp.proxyUser=bob -Dhttp.proxyPassword=theBuilder

我相信在Grails 3.0.x中必须有另一种方法来配置代理,但到目前为止我还没有找到它。

此致

答案 1 :(得分:3)

在linux中添加配置

export GRAILS_OPTS="-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort"
GRAILS_HOME / bin / grails.sh文件中的

。解决我在Netbeans 8.1中的问题

答案 2 :(得分:2)

对于GRAILS3,现在有足够的文档介绍如何设置代理。

正如@campos所说,在Windows中你必须

set GRAILS_OPTS=-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort

但是只进行了一半的校正,因为你还需要纠正gradle引擎,插入gradle.properties值如下所示

systemProp.http.proxyHost=proxy.yourdomain.com
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=yourpass
systemProp.http.nonProxyHosts=localhost

有完整的解释herehere for gradle。有了我在Windows10上的所有功能,我可以在公司代理服务器后面正确编译和构建软件包。

答案 3 :(得分:1)

我将以下内容添加到我的~/.grails/ProxySettings.groovy文件中。

client=['http.proxyHost':'myproxy', 'http.proxyPort':'myport', 'http.proxyUser':'myusername', 'http.proxyPassword':'mypass', 'http.nonProxyHosts':'localhost']
currentProxy='client'

答案 4 :(得分:0)

经过长期的努力,我找到了Windows环境的解决方案 以下对我有用

  

设置GRAILS_OPTS = -Dhttp.proxyHost = myProxy -Dhttp.proxyPort = myPort -Dhttps.proxyHost = myProxy -Dhttps.proxyPort = myPort -Dhttp.proxyUser = bob -Dhttp.proxyPassword = theBuilder