从 5.4 升级到 6.8.3 后如何解决 gradle tls 连接?

How to resolve gradle tls connection after upgrading from 5.4 to 6.8.3?

我将项目 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

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

当 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