首页 > 解决方案 > 从 5.4 升级到 6.8.3 后如何解决 gradle tls 连接问题?

问题描述

我将项目 Gradle 版本从 5.4.1 升级到 6.8.3,并将自定义存储库更改为 https。

我在 maven 上遇到了类似的问题,但是在镜像解决之后。我可以使用 gradle 5.4.1 毫无问题地构建项目,但是当我将 gradle 升级到 6.8.3 时,出现以下错误:

        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/6.8.3/userguide/build_environment.html#gradle_system_properties
                          > sun.security.validator.ValidatorException: 
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

标签: javagradlejava-8android-gradle-pluginjava-11

解决方案


PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径

当 JRE 缺少证书时,您会收到此消息。我认为您将不得不在 docker 映像的 JRE 中安装您公司的证书

您的 Dockerfile 将需要执行以下操作:

FROM adoptopenjdk/openjdk11:jre-11.0.11_9-alpine

// my-company.crt is your company's certificate
COPY my-company.crt my-company.crt

RUN keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias begoroot -file my-company.crt

推荐阅读