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"
}
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 [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
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.
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.
Setting the same options in Jenkins’ or Artifactory’s GUI worked.