title: Gradle proxy configuration
body: <p>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:</p>
  
  <pre><code>apply {
      apply from: "http://gradle.artifactoryonline.com/gradle/plugins/org/jfrog/buildinfo/build-info-extractor-gradle/1.0.1/artifactoryplugin-1.0.1.gradle"
  }
  </code></pre>
  
  <p>Following <a href="http://gradle.org/releases/0.8/docs/userguide/tutorial_this_and_that.html#sec:accessing_the_web_via_a_proxy" rel="noreferrer">this</a> description I specified the following in .gradle/gradle.properties in my home directory:</p>
  
  <pre><code>systemProp.http.proxyHost=hostname
  systemProp.http.proxyPort=8080
  systemProp.http.proxyUser=de\\username
  systemProp.http.proxyPassword=xxx
  </code></pre>
  
  <p>With the above proxy configuration (that is otherwise known to work), it fails:</p>
  
  <blockquote>
    <p>11:33:17.699 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: Server returned HTTP response code: 407 for URL: <a href="http://gradle.artifactoryonline.com/gradle/plugins/org/jfrog/buildinfo/build-info-extractor-gradle/1.0.1/artifactoryplugin-1.0.1.gradle" rel="noreferrer">http://gradle.artifactoryonline.com/gradle/plugins/org/jfrog/buildinfo/build-info-extractor-gradle/1.0.1/artifactoryplugin-1.0.1.gradle</a></p>
  </blockquote>
  
  <p>I have two proxy servers to choose from, and one always responds with <code>407</code> (<em>Proxy authentication required</em>), the other with <code>502</code> (<em>Bad gateway</em>), so obviously, the proxyHost and proxyPort options are used.</p>
  
  <p>As the user name (based on an Active Directory user) contains a backslash, I tried both <code>\\</code> and <code>\</code>, 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.</p>
  
  <p>Setting the same options in Jenkins' or Artifactory's GUI worked.</p>