To set a proxy, you can add arguments in gradlew
:
./gradlew goBuild -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080
And it is the same for other gradlew
command.
Also, you can persist the arguments via ~/.gradle/gradle.properties
or ${projectRoot}/gradle.properties
:
org.gradle.jvmargs=-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080
And HTTP proxy:
-Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port>
And HTTPS proxy:
-Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port>
To learn more about environment and proxy, see Gradle environment and Java proxy
NOTE this only sets proxy for Gogradle
process, not for git
and hg
. If you want to set proxy for git
and hg
, please visit Getting git to work with a proxy server and using hg through a proxy