Monday, September 2, 2013

Jenkins + Gradle + Proxy

To make Gradle use HTTP Proxy when executing on Jenkins with Gradle plugin installed,
one has to use Environment variable JAVA_OPTS to pass proxy servers to Gradle.

For example:

JAVA_OPTS=-Dhttps.proxyHost=192.168.1.1 -Dhttps.proxyPort=3128 -Dhttp.proxyHost=192.168.1.1 -Dhttp.proxyPort=3128

Also one could use gradle.properties or configure gradle build files to use proxies.
Though JAVA_OPTS is a more universal way as one could have multy node configuration of Jenkins. For example: master does not use proxy, and some slave node is located behind proxy, so setting JAVA_OPTS in node environment will do the job.

No comments:

Post a Comment