在我们的企业环境中有一个要求,即将企业证书导入到安装的JDK中。将证书导入到几乎所有可能的位置和安装中...在可能使用它的命令之前设置JAVA_HOME,并在~/. bashrc中设置JAVA_HOME...然而,我每次都得到相同的错误:
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
* Where:
Initialization script '/Users/user/.gradle/init.gradle' line: 2
* What went wrong:
A problem occurred evaluating root project 'some-project'.
> Could not get resource 'https://nexus.our.corp.domain/repository/raw-hosted/gradle/vx.x.x/service.gradle'.
> Could not GET 'https://nexus.our.corp.domain/repository/raw-hosted/gradle/vx.x.x/service.gradle'.
> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5.1/userguide/build_environment.html#gradle_system_properties
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
初始分级内容:
gradle.allprojects {
ext.use_script = { name -> apply from: "$scripts_repo/${name}.gradle" }
}
即使我完全删除了~/.gradle,gradlew,make gradle --stop
中的所有内容,并尝试从头开始初始化/生成gradlew,也会发生PKIX错误:
gradle wrapper --gradle-version x.x.x
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
* Where:
Initialization script '/Users/user/.gradle/init.gradle' line: 2
* What went wrong:
A problem occurred evaluating root project 'some-project'.
> Could not get resource 'https://nexus.our.corp.domain/repository/raw-hosted/gradle/vx.x.x/service.gradle'.
> Could not GET 'https://nexus.our.corp.domain/repository/raw-hosted/gradle/vx.x.x/service.gradle'.
> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5.1/userguide/build_environment.html#gradle_system_properties
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
gradle --version
显示正确的JVM版本:
gradle --version
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.17 (Amazon.com Inc. 11.0.17+8-LTS)
OS: Mac OS X 10.16 x86_64
看起来gradle版本并不重要,因为我们的一位同事偶然发现了gradle版本的同样问题:6.4.1
那么,这个PKIX错误是什么(记住证书是成功导入的),可能的解决方案/修复/变通方案是什么?
- 尝试了不同位置的几个JDK版本(以下所有候选项都成功导入,没有错误,但无论如何都出现了上述PKIX错误):
- JAVA_HOME=/usr/local/Cellar/openjdk@8/1.8.0+352 keytool -importcert -file /path/to/certs/corp-cert -alias Root -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit
- JAVA_HOME=/usr/local/Cellar/openjdk@11/11.0.16.1_1 keytool -importcert -file /path/to/certs/corp-cert -alias Root -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit
1.导出JAVA_HOME=/usr/libexec/java_home -v 11.0.13
;echo“JAVA_HOME-contents:${JAVA_HOME}";keytool -importcert -file /path/to/certs/corp-cert -alias Root -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit - JAVA_HOME=$HOME/.sdkman/candidates/java/11.0.17-amzn keytool -importcert -file /path/to/certs/corp-cert -alias Root -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit
- 尝试从项目中完全删除所有gradle目录(rm -rfv ~/.gradle)和gradlew脚本,因为建议可能是gradle版本以某种方式干扰/混乱
- 我试着删除所有的sdkman遗留文件,并从头开始安装所有需要的项目(sdk install java 11.0.17-amzn),因为建议可能是gradle版本以某种方式干扰/混乱
1条答案
按热度按时间vktxenjb1#
结果一直都是错误的证书...