Gradle配置代理

在gradle.properties文件中添加如下配置:

配置http proxy:

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

配置https proxy:

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
# NOTE: this is not a typo.
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

配置SOCKS proxy:

systemProp.socksProxyHost=www.somehost.org
systemProp.socksProxyPort=1080
systemProp.java.net.socks.username=userid
systemProp.java.net.socks.password=password

如果在代理软件中出现unknown Socks version: 67错误,需要将代理设置为SOCKS proxy

官方文档连接:https://docs.gradle.org/current/userguide/networking.html

posted @ 2024-09-16 11:03  Hekk丶  阅读(703)  评论(0)    收藏  举报