gradlew.bat (and gradlew) SSLHandShakeException on wrappers but not on installed gradle
<pre><code> Downloading https://services.gradle.org/distributions/gradle-2.12-bin.zip

 Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
</code></pre>

<p>Similar issue to this:</p>

<p><a href="https://stackoverflow.com/questions/29584328/gradlew-bat-and-gradlew-sslhandshakeexception">gradlew.bat (and gradlew) SSLHandShakeException</a></p>

<p>Except I only get this exception when executing via the wrapper? (Installed local gradle command works without any problems.) I tried the solutions suggested and just cannot get it to work. I even downloaded and installed the certificate from <a href="https://services.gradle.org/distributions/" rel="nofollow noreferrer">https://services.gradle.org/distributions/</a> in cacerts</p>

<pre><code> keytool -import -file "C:\tmp\gradlew.x509.base64.cer" -alias gradle -keystore "C:\Apps\java\jre\lib\security\cacerts"
</code></pre>

<p>I got the command from the wrapper:</p>

<pre><code> java -Dorg.gradle.appname=gradlew -classpath "C:\mystuff\gradle-2.12\samples\java\multiproject\\gradle\wrapper\gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain clean
</code></pre>

<p>My guess is maybe something is wrong with the certificate itself or maybe I am using the wrong encoding?</p>

<pre><code> $ java -version
 Picked up _JAVA_OPTIONS: -Xmx512M
 java version "1.7.0_25"
 Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
 Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
</code></pre>

<p>To complicate this, I tried installing certificate from gradle using the method suggested here, which appears to have worked (according to output)</p>

<p><a href="http://infposs.blogspot.ca/2013/06/installcert-and-java-7.html" rel="nofollow noreferrer">http://infposs.blogspot.ca/2013/06/installcert-and-java-7.html</a></p>

<p>But when I run the wrapper, I still get the same error.</p>