Reputation: 119
I'm using IntelliJ to synchronize Gradle. The Gradle project is provided by IntelliJ template, but still the error persists.
I've tried to:
My system: MacOS Big Sur
So this is the error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not download junit-jupiter-api-5.7.0.jar (org.junit.jupiter:junit-jupiter-api:5.7.0)
Could not get resource 'https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar'.
Could not GET 'https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar'.
The server may not support the client's requested TLS protocol versions: (TLSv1.2). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.1/userguide/build_environment.html#gradle_system_properties
Remote host closed connection during handshake
SSL peer shut down incorrectly
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not download junit-jupiter-api-5.7.0.jar (org.junit.jupiter:junit-jupiter-api:5.7.0)
Could not get resource 'https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar'.
Could not GET 'https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar'.
The server may not support the client's requested TLS protocol versions: (TLSv1.2). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.1/userguide/build_environment.html#gradle_system_properties
Remote host closed connection during handshake
SSL peer shut down incorrectly
at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:346)
at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:127)
...[omitted numerous lines]
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar'
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar'.
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: The server may not support the client's requested TLS protocol versions: (TLSv1.2). You may need to configure the client to allow other protocols to be used.
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:990)
This is my gradle build script:
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
test {
useJUnitPlatform()
}
A ZILLION THANKS!!!!!!!!
Upvotes: 7
Views: 14185
Reputation: 34
This is one way to go about it thanks to Katastros
Problem: New project sync gradle cannot be synchronized after installing Android Studio
Solution: modify the content under gradle/wrapper/gradle-wrapper.properties,
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
To:
distributionUrl=http://services.gradle.org/distributions/gradle-5.1.1-all.zip
Upvotes: 2
Reputation: 306
Try running the build task as "gradle -Dhttps.protocols=TLSv1.2 clean build" Incase you are using intellij to build add Vm arg "-Dhttps.protocols=TLSv1.2"
Upvotes: 3
Reputation: 141
This is because Maven Central and Bintray have announced that they will discontinue support for TLS v1.1 and below
replace mavenCentral() with maven { url = "http://repo.maven.apache.org/maven2" } and jcenter() with maven { url = "http://jcenter.bintray.com" }
For more info: https://blog.gradle.org/unable-to-download-maven-central-bintray
Upvotes: 3