Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSLPeerUnverifiedException while downloading file from github using Gradle task

Tags:

github

gradle

I need to get a file from github using gradle. I found this plugin. The following example works for me:

task downloadZipFile(type: Download) {
    src 'https://github.com/michel-kraemer/gradle-download-task/archive/1.0.zip'
    dest new File(buildDir, '1.0.zip')
}

But when i replace URL with the one i need: (https://github.com/broadinstitute/cromwell/releases/download/0.19/cromwell-0.19.jar) i get the following error:

8:00:37 AM: Executing external task 'downloadZipFile'...
:downloadZipFile
Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Fri, 13 Jun 2036 12:00:38 -0000; secure; HttpOnly". Invalid 'expires' attribute: Fri, 13 Jun 2036 12:00:38 -0000
:downloadZipFileFAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':downloadZipFile'.
> javax.net.ssl.SSLPeerUnverifiedException: Host name 'github-cloud.s3.amazonaws.com' does not match the certificate subject provided by the peer (CN=*.s3.amazonaws.com, O=Amazon.com Inc., L=Seattle, ST=Washington, C=US)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.91 secs
Host name 'github-cloud.s3.amazonaws.com' does not match the certificate subject provided by the peer (CN=*.s3.amazonaws.com, O=Amazon.com Inc., L=Seattle, ST=Washington, C=US)
8:00:39 AM: External task execution finished 'downloadZipFile'.

What can be wrong, i just replace github URL with another github URL.

like image 748
Kirill Avatar asked Mar 06 '26 11:03

Kirill


1 Answers

Per this comment, add the following to the beginning of your build.gradle script:

// Temporary workaround, see
// https://github.com/michel-kraemer/gradle-download-task/issues/56
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'de.undercouch:gradle-download-task:3.1.1'
        classpath 'org.apache.httpcomponents:httpclient:4.5.2'
    }
}

That worked for me.

like image 71
mernst Avatar answered Mar 09 '26 16:03

mernst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!