java.security.cert.CertificateException: No name matching services.gradle.org found

When I switch my gradle wrapper url to https protocol (distributionUrl=https://services.gradle.org/distributions/gradle-1.12-bin.zip), I get:

./gradlew tasks
Downloading https://services.gradle.org/distributions/gradle-1.12-bin.zip
  Exception in thread "main" java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching services.gradle.org found
 at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
 at org.gradle.wrapper.Install.createDist(Install.java:44)
 at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
 at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:55)
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching services.gradle.org found
 at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
 at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)
 at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
 at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)
 at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1341)
 at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:153)
 at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
 at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
 at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)
 at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
 at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
 at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
 at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
 at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
 at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
 at org.gradle.wrapper.Download.downloadInternal(Download.java:56)
 at org.gradle.wrapper.Download.download(Download.java:42)
 at org.gradle.wrapper.Install$1.call(Install.java:57)
 at org.gradle.wrapper.Install$1.call(Install.java:44)
 at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
 ... 3 more
Caused by: java.security.cert.CertificateException: No name matching services.gradle.org found
 at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:208)
 at sun.security.util.HostnameChecker.match(HostnameChecker.java:93)
 at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:347)
 at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:203)
 at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
 at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1323)
 ... 19 more

Changing https to http solves this problem.

./gradlew --version
  ------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------
  Build time:
 2014-04-29 09:24:31 UTC
Build number: none
Revision:
   a831fa866d46cbee94e61a09af15f9dd95987421
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy:
        2.2.0
JVM:
        1.7.0_40 (Oracle Corporation 24.0-b56)
OS:
         Mac OS X 10.9.2 x86_64

I also get this exception and it is visible when trying to download Gradle from gradle.org as well. Firefox is reporting that the certificate is self-signed and for demo.gradleware.com.

We are working on a fix. Should be back to normal in a few hours.

This is now fixed.