由于未解决的依赖关系无法创建新的 Play 项目 - SunCertPathBuilderException:无法找到有效的证书

Can't create new Play project due to unresolved dependency - SunCertPathBuilderException: unable to find valid certification

我第一次尝试创建新的游戏项目。由于与 https://repo.typesafe.com/* 相关的错误 sun.security.validator.ValidatorException,我不能。如何添加证书?

我按照命令

在 mac 和 运行 上安装了 sbt
sbt new playframework/play-java-seed.g8
sbt run

实际结果是

:: problems summary ::
:::: ERRORS
    Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/9/jars/oss-parent.jar

    Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/org.apache/apache/18/jars/apache.jar

...

[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.typesafe.play:sbt-plugin:2.7.2 (scalaVersion=2.12, sbtVersion=1.0)
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      com.typesafe.play:sbt-plugin:2.7.2 (scalaVersion=2.12, sbtVersion=1.0) (/Users/dzejn/Documents/Development/PlayTrials/play-samples-play-java-hello-world-tutorial/project/plugins.sbt#L1-2)
[warn]        +- default:play-samples-play-java-hello-world-tutorial-build:0.1.0-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)
[error] sbt.librarymanagement.ResolveException: unresolved dependency: com.typesafe.play#sbt-plugin;2.7.2: Resolution failed several times for dependency: com.typesafe.play#sbt-plugin;2.7.2 {compile=[default(compile)]}:: 
[error]     typesafe-ivy-releases: unable to get resource for com.typesafe.play#sbt-plugin;2.7.2: res=https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.2/ivys/ivy.xml: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[error]     sbt-plugin-releases: unable to get resource for com.typesafe.play#sbt-plugin;2.7.2: res=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.2/ivys/ivy.xml: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[error] 
[error]     at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:332)
[error]     at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither(IvyActions.scala:208)
[error]     at sbt.internal.librarymanagement.IvyActions$$$Lambda80/1497726062.apply(Unknown Source)
[error]     at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule(Ivy.scala:239)

我正在使用 macOS、sbt 1.2.8、java 1.8.0_45,sbt 是用 brew 新安装的。我没有 JAVA_HOME/jre/lib/security/cacerts 目录,而且我不支持似乎与针对类似问题提出的解决方案相关的代理。

谢谢

I am using macOS, sbt 1.2.8, java 1.8.0_45, sbt freshly installed with brew.

我的猜测是 Java 1.8.0_45 太旧了。我目前使用的是1.8.0_212。 您可以从 https://adoptopenjdk.net/ or use something like https://sdkman.io/.

中获取一个