在Teamcity中运行Gradle Wrapper时无法通过代理进行隧道传输

时间:2017-06-19 15:59:32

标签: java gradle proxy teamcity

我在代理后面运行Teamcity中的gradle构建,并且面临Gradle Wrapper无法下载Gradle zip文件的问题。

我已通过gradle参数将代理设置添加到Gradle命令。

/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] 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

我还尝试了以下设置代理的变体:

-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=

并尝试禁用基本身份验证的隧道,如下所示:

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

这些选项似乎都没有在Teamcity中起作用。还有什么我应该做的吗?

非常感谢你的帮助。

1 个答案:

答案 0 :(得分:2)

事实证明,teamcity运行构建的主机/代理并没有连接到互联网。另一个代理商,能够下载gradle安装就好了,并完成整个构建。