【问题标题】:Gradle, can't access to online repositories through a proxyGradle,无法通过代理访问在线存储库
【发布时间】:2017-04-03 13:45:57
【问题描述】:

我正在尝试使用 gradle 构建我的项目。 我在代理后面,我更新了这个文件 gradle.properties,我添加了这些行

systemProp.proxySet=true
systemProp.http.proxyHost=http://cache.ha.opari.com
systemProp.http.proxyPort=3328
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.proxyHost=http://cache.ha.opari.com
systemProp.https.proxyPort=3328
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

当我使用 gradle 启动构建时,我仍然遇到同样的问题

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':icore:compileJava'.
> Could not resolve all dependencies for configuration ':icore:compileClasspath'.
   > Could not resolve colt:colt:1.2.0.
     Required by:
         project :icore
      > Could not resolve colt:colt:1.2.0.
         > Could not get resource 'https://repo1.maven.org/maven2/colt/colt/1.2.0/colt-1.2.0.pom'.
            > Could not GET 'https://repo1.maven.org/maven2/colt/colt/1.2.0/colt-1.2.0.pom'.
               > http://cache.ha.opari.com

【问题讨论】:

    标签: gradle proxy


    【解决方案1】:

    From my answer at related question: Gradle installation having a proxy issue

    对我来说,issuehttp 前缀!如果是这种情况,请删除 http/https 前缀!

    我的 gradle.properties 是这样的,但失败了:

    systemProp.http.proxyHost=http://squid.proxy.com
    systemProp.http.proxyPort=8080
    systemProp.https.proxyHost=http://squid.proxy.com
    systemProp.https.proxyPort=8080
    

    为 gradle 设置代理设置的正确方法是:

    systemProp.http.proxyHost=squid.proxy.com
    systemProp.http.proxyPort=8080
    systemProp.https.proxyHost=squid.proxy.com
    systemProp.https.proxyPort=8080
    

    【讨论】:

      【解决方案2】:

      好吧,由于错误包含您的代理的 URL,我会说代理设置工作正常,但您的代理不允许您访问该位置。也许尝试使用-s 运行以获取错误的完整堆栈跟踪以获得更多洞察力。

      【讨论】:

      • 当然结果相同,但没有更多信息?没有堆栈跟踪? o_O 然后尝试使用-i 或者如果仍然没有足够的信息使用-d
      • resolved :) 我把代理地址没有 http 和 https 它现在可以工作 O.o
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多