sj0509
sj0509

Reputation: 223

Unable to tunnel through proxy when running Gradle Wrapper in Teamcity

I'm running my gradle build in Teamcity behind a proxy, and facing an issue with the Gradle Wrapper being unable to download the Gradle zip file.

I've added the proxy settings to the Gradle command via gradle parameters.

/export/home/**/teamcity/work/1ea348ab17354b2f/gradlew --init-script /export/home/**/teamcity/plugins/gradle-runner/scripts/init.gradle -Djdk.http.auth.tunneling.disabledSchemes=”” -Djdk.http.auth.proxying.disabledSchemes=”” -Dhttp.proxyHost=***.com -Dhttp.proxyPort=3128 -Dhttp.proxyUser=** -Dhttp.proxyPassword=** -Dorg.gradle.daemon=false -d -b build.gradle bootRepackage

Here's the Exception I get :

[11:49:21]   [Step 1/1] Starting: bash /export/home/**/teamcity/work/1ea348ab17354b2f/gradlew --init-script /export/home/**/teamcity/plugins/gradle-runner/scripts/init.gradle -Djdk.http.auth.tunneling.disabledSchemes=”” -Djdk.http.auth.proxying.disabledSchemes=”” -Dhttp.proxyHost=***.com -Dhttp.proxyPort=3128 -Dhttp.proxyUser=** -Dhttp.proxyPassword=** -Dorg.gradle.daemon=false -d -b build.gradle bootRepackage
[11:49:21]  [Step 1/1] in directory: /export/home/**/teamcity/work/1ea348ab17354b2f
[11:49:21]  [Step 1/1] Downloading https://services.gradle.org/distributions/gradle-4.0-all.zip
[11:49:21]  [Step 1/1] 
[11:49:21]   [Step 1/1] Exception in thread "main" java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
[11:49:21]  [Step 1/1]  at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2084)
[11:49:21]  [Step 1/1]  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
[11:49:21]  [Step 1/1]  at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)
[11:49:21]  [Step 1/1]  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
[11:49:21]  [Step 1/1]  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.Download.downloadInternal(Download.java:66)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.Download.download(Download.java:51)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.Install$1.call(Install.java:62)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.Install$1.call(Install.java:48)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.Install.createDist(Install.java:48)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
[11:49:21]  [Step 1/1]  at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
[11:49:21]  [Step 1/1] Process exited with code 1
[11:49:21]  [Step 1/1] Step Gradle failed

I have also tried the following variations of setting the proxy :

-Dhttps.proxyHost=
-Dhttps.proxyPort=
-Dhttps.proxyUser=
-Dhttps.proxyPassword=

-DsystemProp.http.proxyHost=
-DsystemProp.http.proxyPort=
-DsystemProp.http.proxyUser=
-DsystemProp.http.proxyPassword=

-DsystemProp.https.proxyHost=
-DsystemProp.https.proxyPort=
-DsystemProp.https.proxyUser=
-DsystemProp.https.proxyPassword=

And have tried disabling tunneling for Basic Authentication as here :

-Djdk.http.auth.tunneling.disabledSchemes=””
-Djdk.http.auth.proxying.disabledSchemes=””

None of these options have seemed to work in Teamcity. Is there anything else I should be doing ?

Thanks much for your help.

Upvotes: 0

Views: 4132

Answers (1)

sj0509
sj0509

Reputation: 223

As it turns out, the host/agent on which teamcity was running the build, wasnt connecting to the internet. Another agent which was, was able to download the gradle installation just fine, and run through the complete build.

Upvotes: 2

Related Questions