当前位置: 首页 > 知识库问答 >
问题:

Gradle同步错误:SSL对等服务器错误关闭

曾皓
2023-03-14

我在用IntelliJ同步Gradle。Gradle项目由IntelliJ模板提供,但错误仍然存在。

我试着:

  1. 使用Android Studio做同样的事情,同样的事情发生了

我的系统:MacOS Big Sur

所以这是错误:

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)

这是我的gradle构建脚本:

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()
}

非常感谢!!!!!!!!

共有2个答案

刘高峯
2023-03-14

尝试运行构建任务"gradle-Dhttps.protocols=TLSv1.2清洁构建"如果您使用intellij构建添加Vm arg"-Dhttps.protocols=TLSv1.2"

谢和颂
2023-03-14

这是因为Maven Central和Bintray已宣布他们将停止对TLS v1.1及以下版本的支持

将mavenCentral()替换为maven{url="http://repo.maven.apache.org/maven2"},将jcenter()替换为maven{url="http://jcenter.bintray.com"}

欲了解更多信息:https://blog.gradle.org/unable-to-download-maven-central-bintray

 类似资料:
  • 在jenkins中调试从nexus下载的maven后,我出现了以下错误。 Openssl工作正常,证书是由Amazon发布的有效证书。

  • 如果我在以下URL上运行上述代码:https://eztv.it/shows/887/the-blacklist/,它将按预期工作。两个URL文件大小之间的差异似乎是一个促成因素。在测试同一个服务器的不同URL时,上面的代码似乎只适用于小于30KB的文件。以上任何内容都将生成上述异常。

  • 我有一个问题,集成liquibase maven执行与一个mysql 5.7数据库由Azure作为一个服务.错误日志是: 无法执行目标组织。liquibase:liquibase maven插件:3.0.5:项目上的状态(默认cli)-:设置或运行liquibase:com时出错。mysql。jdbc。例外情况。jdbc4。通信异常:通信链路故障发送到服务器的最后一个数据包是575毫秒前的。握手期

  • 我需要通过HTTPS协议提出请求。我编写了以下代码: 有人知道为什么会这样吗?

  • 问题内容: 我正在尝试做一个简单的HttpGet来读取网页。我在iOS和Android上通过http(而非https)工作。 网址是内部网络IP和自定义端口,因此我可以使用以下路径使用http读取此类内容: 当我尝试使用https时,出现错误。所以我尝试使用此代码: 但这给我一个错误。 我究竟做错了什么?我可以放心地忽略该证书,因为它是一个具有自签名证书的内部网络,但是我无法控制版本,我的应用程序

  • 当我尝试使用Android SDK管理器下载适用于Android 4.1的ARM EABI时,它拒绝安装。我收到以下消息:“SSL对等点错误关闭”。这是在Windows XP操作系统上。你知道这里发生了什么,我能做些什么来解决这个问题吗?