gradle build failure连接到https://repo1.maven.org被拒绝

时间:2015-05-29 09:56:19

标签: build gradle proxy

我正在尝试构建一个包含在gradle分发中的示例项目。当我gradle build时,我收到此错误:

Could not resolve commons-collections:commons-collections:3.2.1.
Required by:
    :application:1.0.2
 > Could not HEAD 'https://repo1.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.pom'.
    > Connection to https://repo1.maven.org refused

我在代理后面工作。我试过这里提到的东西: gradle documentation for proxy configuration但我得到了同样的错误。 你能帮忙吗?

1 个答案:

答案 0 :(得分:8)

使用以下内容在.gradle文件旁边添加gradle.properties文件:

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost 

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost