【问题标题】:grails 3.0.1 proxy settingsgrails 3.0.1 代理设置
【发布时间】:2018-06-20 13:29:46
【问题描述】:

我是 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

【问题讨论】:

  • 能否还请您补充一下,到目前为止您已经尝试过什么(例如,通常怀疑通过 JAVA/GRAILS_OPTS 设置,是否在 http_proxy 中设置,...)

标签: grails proxy


【解决方案1】:

我遇到了同样的问题,并通过以下方式将代理配置添加到 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 中必须有另一种配置代理的方法,但我目前还没有找到。

问候

【讨论】:

【解决方案2】:

在linux中添加配置

export GRAILS_OPTS="-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort"

在 GRAILS_HOME/bin/grails.sh 文件中。解决我在 Netbeans 8.1 中的问题

【讨论】:

  • set GRAILS_OPTS=-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort 在 Windows 中
【解决方案3】:

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

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

【讨论】:

    【解决方案4】:

    对于 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 上的所有这些,我可以在我的公司代理后面正确编译和构建包。

    【讨论】:

      【解决方案5】:

      经过长期的奋斗,我找到了windows环境的解决方案 以下对我有用

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

      【讨论】:

        猜你喜欢
        • 2015-07-26
        • 1970-01-01
        • 1970-01-01
        • 2015-06-16
        • 1970-01-01
        • 2015-06-13
        • 2015-06-13
        • 2015-06-18
        • 2015-05-21
        相关资源
        最近更新 更多