title: Gradle build failed behind proxy
body: <p>I'm trying to build <a href="https://github.com/cloudfoundry-samples/spring-music" rel="nofollow noreferrer">Spring music app</a> using Gradle. This is the command I'm trying to use:</p>
  
  <pre><code>./gradlew clean build
  </code></pre>
  
  <p>It fails as follows:</p>
  
  <blockquote>
    <p>FAILURE: Build failed with an exception.</p>
    
    <ul>
    <li>What went wrong: Could not resolve all dependencies for configuration ':detachedConfiguration1'.
    
    <blockquote>
      <p>Could not resolve org.springframework.boot:spring-boot-dependencies:2.0.1.RELEASE.<br>
      Required by:
        project :
      Could not resolve org.springframework.boot:spring-boot-dependencies:2.0.1.RELEASE.
      Could not get resource '<a href="https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.0.1.RELEASE/spring-boot-dependencies-2.0.1.RELEASE.pom" rel="nofollow noreferrer">https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.0.1.RELEASE/spring-boot-dependencies-2.0.1.RELEASE.pom</a>'.
      Could not HEAD '<a href="https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.0.1.RELEASE/spring-boot-dependencies-2.0.1.RELEASE.pom" rel="nofollow noreferrer">https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.0.1.RELEASE/spring-boot-dependencies-2.0.1.RELEASE.pom</a>'.
      sun.security.validator.ValidatorException: PKIX path building failed:
      sun.security.provider.certpath.SunCertPathBuilderException: unable to
      find valid certification path to requested target</p>
    </blockquote></li>
    </ul>
  </blockquote>
  
  <p>I had a look on <a href="https://stackoverflow.com/questions/36202894/gradle-use-certificate-authentication-for-repository">this topic</a> and did the following:</p>
  
  <p>1- Created ~/.gradle/gradle.properties and put the following inside:</p>
  
  <pre><code>org.gradle.jvmargs=-Djavax.net.ssl.keyStore="/Users/myusername/my_private_company_ca_bundle" -Djavax.net.ssl.keyStoreType=KeychainStore -Djavax.net.ssl.keyStorePassword=changeit
  </code></pre>
  
  <p>2- Also I added my CA bundle (Root CA and intermediate CA in one file)</p>
  
  <pre><code>sudo keytool -import -trustcacerts -alias root -file ./certificates/my_private_company_ca_bundle -keystore $JAVA_HOME/jre/lib/security/cacerts
  </code></pre>
  
  <p>Also, I made sure I'm putting my proxy settings in ~/.gradle/gradle.properties:</p>
  
  <pre><code>systemProp.http.proxyHost=&lt;corporate_proxy&gt;
  systemProp.http.proxyPort=8080
  systemProp.https.proxyHost=&lt;corporate_proxy&gt;
  systemProp.https.proxyPort=8080
  </code></pre>
  
  <p>Here is my Java version: </p>
  
  <pre><code>java -version
  java version "1.8.0_211"
  Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
  Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
  </code></pre>
  
  <p>What could be missing in my settings?</p>