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

时间:2019-05-11 21:42:38

标签: java playframework sbt

我正在尝试首次创建新的游戏项目。由于与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$1(IvyActions.scala:208)
[error]     at sbt.internal.librarymanagement.IvyActions$$$Lambda$2480/1497726062.apply(Unknown Source)
[error]     at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:239)

我正在使用macOS,sbt 1.2.8,java 1.8.0_45,srew新安装的sbt。我没有JAVA_HOME / jre / lib / security / cacerts目录,而且我也不在代理后面,后者似乎与针对类似问题的解决方案有关。

谢谢

1 个答案:

答案 0 :(得分:1)

  

我正在使用macOS,sbt 1.2.8,java 1.8.0_45,与brew一起新安装的sbt。

我的猜测是Java 1.8.0_45太旧了。我当前使用的是1.8.0_212。 您可以从https://adoptopenjdk.net/中抢一把,也可以使用https://sdkman.io/之类的东西。