摇篮代理配置 [英] Gradle proxy configuration

查看:134
本文介绍了摇篮代理配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过代理服务器需要从摇篮网络访问使用摇篮/ Artifactory的集成詹金斯。为了减少可能的原因的问题,我手动添加Artifactory的插件在build.gradle和命令行运行它:

I need web access from Gradle through a proxy server to use the Gradle/Artifactory integration for Jenkins. To reduce possible causes for issues, I manually add the Artifactory plugin in build.gradle and run it from command line:

apply {
    apply from: "http://gradle.artifactoryonline.com/gradle/plugins/org/jfrog/buildinfo/build-info-extractor-gradle/1.0.1/artifactoryplugin-1.0.1.gradle"
}

随着<一href="http://gradle.org/releases/0.8/docs/userguide/tutorial_this_and_that.html#sec%3aaccessing_the_web_via_a_proxy">this说明我指定.gradle以下/我的主目录gradle.properties:

Following this description I specified the following in .gradle/gradle.properties in my home directory:

systemProp.http.proxyHost=hostname
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=de\\username
systemProp.http.proxyPassword=xxx

通过上述代理配置(即也称为工作),失败:

With the above proxy configuration (that is otherwise known to work), it fails:

11:33:17.699 [错误] [org.gradle.BuildExceptionReporter]产生的原因:java.io.IOException异常:服务器返回的HTTP响应code:407网址:<一href="http://gradle.artifactoryonline.com/gradle/plugins/org/jfrog/buildinfo/build-info-extractor-gradle/1.0.1/artifactoryplugin-1.0.1.gradle">http://gradle.artifactoryonline.com/gradle/plugins/org/jfrog/buildinfo/build-info-extractor-gradle/1.0.1/artifactoryplugin-1.0.1.gradle

11:33:17.699 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: Server returned HTTP response code: 407 for URL: http://gradle.artifactoryonline.com/gradle/plugins/org/jfrog/buildinfo/build-info-extractor-gradle/1.0.1/artifactoryplugin-1.0.1.gradle

我有两个代理服务器可供选择,一个始终与响应407 代理身份验证的),其他与 502 错误网关的),所以很明显,ProxyHost的和proxyPort选项使用。

I have two proxy servers to choose from, and one always responds with 407 (Proxy authentication required), the other with 502 (Bad gateway), so obviously, the proxyHost and proxyPort options are used.

作为用户名(基于Active Directory用户)包含反斜杠,我都尝试 \\ \ ,但是没有奏效。指定的用户从登录到本机和Active Directory中的用户不同。这个用户的凭据是无效的代理,所以我需要能够指定一个不同的用户。

As the user name (based on an Active Directory user) contains a backslash, I tried both \\ and \, but neither worked. The user specified is different from the user that is logged in to the machine and Active Directory. This user's credentials aren't valid for the proxy, so I need to be able to specify a different user.

设置在詹金斯的相同选项或Artifactory的GUI的工作。

Setting the same options in Jenkins' or Artifactory's GUI worked.

推荐答案

使用的非常的简单的请求URLJava程序,我是能够复制的问题。

Using a very simple "Request a URL" Java program, I was able to replicate the issue.

http.proxyUser http.proxyPassword 似乎是不规范的,虽然流行,期权,因为他们再在从摇篮教程 Java参考页面链接未说明;即使摇篮手册中提到他们。

http.proxyUser and http.proxyPassword seem to be non-standard, albeit popular, options, as they're not described in the Java reference page linked from the Gradle tutorial; even though the Gradle manual mentions them.

看来想支持代理身份验证需要手动执行此操作(我能够使用code中的链接页面上做到这一点)。

It seems Java programs that wish to support proxy authentication need to do this manually (and I was able to do this using the code on the linked page).

我提出这个问题(和修复),以的摇篮问题跟踪

I submitted this issue (and a fix) to the Gradle issue tracker.

这篇关于摇篮代理配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆