Gradle,无法通过代理访问在线存储库

时间:2017-04-03 13:45:57

标签: gradle proxy

我正在尝试使用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

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

From my answer at related questionGradle 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