gpt4 book ai didi

java - 尽管安装了证书,但由于 sun.security.validator.ValidatorException 导致 Gradle 构建失败

转载 作者:行者123 更新时间:2023-12-01 12:55:41 24 4
gpt4 key购买 nike

我正在尝试运行 lenskit-hello根据他们的指示。当我跑 ./gradlew build ,我收到错误

(base) Briennas-MBP:lenskit-hello-master briennakh$ ./gradlew build
:compileJava

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not resolve org.lenskit:lenskit-all:3.0-M3.
Required by:
:lenskit-hello-master 4.50.57 AM:unspecified
> Could not resolve org.lenskit:lenskit-all:3.0-M3.
> Could not get resource 'https://repo1.maven.org/maven2/org/lenskit/lenskit-all/3.0-M3/lenskit-all-3.0-M3.pom'.
> Could not GET 'https://repo1.maven.org/maven2/org/lenskit/lenskit-all/3.0-M3/lenskit-all-3.0-M3.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve org.lenskit:lenskit-all:3.0-M3.
> Could not get resource 'https://jcenter.bintray.com/org/lenskit/lenskit-all/3.0-M3/lenskit-all-3.0-M3.pom'.
> Could not GET 'https://jcenter.bintray.com/org/lenskit/lenskit-all/3.0-M3/lenskit-all-3.0-M3.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.009 secs

我在 MacOS Mojave 10.14.6 上使用 Java 1.8.0_241(并且只安装了那个)。我已经安装了最新的安全更新,然后重新启动了我的计算机。我已经在我的常规 wifi 和我手机的热点上尝试过这个。

我按照接受的答案中的说明进行操作 here ,从 https://repo1.maven.org/maven2/org/lenskit/lenskit-all/3.0-M2/lenskit-all-3.0-M2.pom 下载安全证书和 https://oss.sonatype.org/content/repositories/snapshots/org/lenskit/lenskit-all/3.0-M2/lenskit-all-3.0-M2.pom并通过以下命令将它们添加到 keystore (仅显示两个之一):
keytool -import -alias maven -file /Users/briennakh/Downloads/maven.cer -keystore 
/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/security/cacerts

那么如果我检查
keytool -list -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/security/cacerts | grep maven

它显示我的证书已添加, maven, Mar 17, 2020, trustedCertEntry ,但我在运行 ./gradlew build 时仍然遇到同样的错误?

我也查了 openssl x509 -in /Users/briennakh/Downloads/maven.pem -text以确保证书看起来没问题。

最佳答案

那个SSL certificate开始时不是自签名的,因此不需要手动添加。尝试重新安装 Java 或将备用安装位置设置为 $JAVA_HOME ,默认为 cacerts文件。有些东西似乎坏了,因为它不应该拒绝 repo1.maven.org 的证书. ls -la $JAVA_HOME/jre/lib/security/cacertscacerts应该有大约 114757 个字节。如果您在防火墙后面,您可能需要 configure a proxy对于 Gradle。

这应该尝试 SSL session (不是通过 Java):

$ openssl s_client -connect repo1.maven.org:443

这个项目还使用了一个相当 outdated version Gradle 的,例如:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

关于java - 尽管安装了证书,但由于 sun.security.validator.ValidatorException 导致 Gradle 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60720241/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com