【发布时间】:2020-03-17 10:16:16
【问题描述】:
我正在尝试按照他们的指示运行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 下载安全证书,并通过以下命令将它们添加到密钥库(仅显示其中之一):
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 以确保证书看起来没问题。
【问题讨论】:
-
确认一下,你确定
JAVA_HOME环境变量正确指向/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk吗? -
它指向
/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home@michalk -
我用
echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile设置这个。
标签: java macos gradle java-8 ssl-certificate