2015-04-20 32 views
8

我是新來的Grails 3.0.1,想知道如何以及在哪裏設置正確的代理設置。我知道我的代理配置是什麼 - IP和端口,但不知道在哪裏放置。grails 3.0.1代理設置

[email protected]:~/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 
+0

請問你還可以補充一下,你到目前爲止嘗試過的東西(例如,通過JAVA/GRAILS_OPTS設置的常見嫌疑犯,是否在http_proxy中設置,...) – cfrick

回答

11

我有同樣的問題,並解決它加入代理服務器配置到GRAILS_HOME /斌/ grails.bat文件中的以下內容: 試圖運行的Grails我的HelloWorld項目中的命令時,我得到這樣的錯誤方式:

>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中必須有另一種方式來配置代理,但我還沒有找到它到目前爲止。

問候

+0

謝謝!它爲我工作 – user2361862

+0

這已添加到用戶指南https://github.com/grails/grails-doc/commit/5f1bb09b6e02d3a07fce82a74f4dff7ec6a0e618 –

1

我adedd下面我~/.grails/ProxySettings.groovy文件。

client=['http.proxyHost':'myproxy', 'http.proxyPort':'myport', 'http.proxyUser':'myusername', 'http.proxyPassword':'mypass', 'http.nonProxyHosts':'localhost'] 
currentProxy='client' 
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中解決我的問題

+0

或'設置GRAILS_OPTS = -Dhttp.proxyHost = myProxy -Dhttp.proxyPort = myPort -Dhttps .proxyHost = myProxy -Dhttps.proxyPort = myPort在Windows中 – JohnTheBeloved

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上的所有功能,我可以在我的公司代理之後正確編譯和構建軟件包。