与证书相关的 SBT 项目编译错误
Posted
技术标签:
【中文标题】与证书相关的 SBT 项目编译错误【英文标题】:SBT project compilation error related to certs 【发布时间】:2021-04-03 06:15:16 【问题描述】:当我尝试从 IntelliJ 或命令提示符构建 sbt 项目时,我收到与 SSL 握手相关的错误。简单的“Hello World”项目可以编译,但是当我为 Play 框架添加插件时,我得到了这些错误。
我将 repo.scala-sbt.org、dl.bintray.com 证书添加到 Java 密钥库以及密钥库路径 (Djavax.net.ssl.trustStore) 到 sbt 配置,但这并没有解决问题。有解决此问题的建议吗?
-- TIA
-Djavax.net.ssl.trustStore="\jre\lib\security\cacerts"
[错误](更新)lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts:获取工件时出错:
[错误]https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.8.2/jars/sbt-plugin.jar:下载错误:捕获 javax.net.ssl.SSLHandshakeException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径(PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:在下载https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.8.2/jars/sbt-plugin.jar时无法找到到所请求目标的有效认证路径@
[错误] https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-native-packager/scala_2.12/sbt_1.0/1.5.1/jars/ sbt-native-packager.jar:下载错误:捕获 javax.net.ssl.SSLHandshakeException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径(PKIX 路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException:无法找到到所请求目标的有效认证路径),同时下载 https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-native- packager/scala_2.12/sbt_1.0/1.5.1/jars/sbt-native-packager.jar
[错误] https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-native-packager/scala_2.12/sbt_1.0/1.5.1/docs/ sbt-native-packager-javadoc.jar:下载错误:捕获 javax.net.ssl.SSLHandshakeException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径(PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:在下载 https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-时无法找到到所请求目标的有效证书路径native-packager/scala_2.12/sbt_1.0/1.5.1/docs/sbt-native-packager-javadoc.jar
[错误] https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-js-engine/scala_2.12/sbt_1.0/1.2.3/docs/ sbt-js-engine-javadoc.jar:下载错误:捕获 javax.net.ssl.SSLHandshakeException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径(PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:在下载 https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-时无法找到到所请求目标的有效证书路径js-engine/scala_2.12/sbt_1.0/1.2.3/docs/sbt-js-engine-javadoc.jar
[错误] https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-web/scala_2.12/sbt_1.0/1.4.4/docs/sbt- web-javadoc.jar:下载错误:捕获 javax.net.ssl.SSLHandshakeException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效认证路径(PKIX 路径构建失败:sun.下载 https:repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-web/scala_2 时,security.provider.certpath.SunCertPathBuilderException:无法找到到所请求目标的有效证书路径。 12/sbt_1.0/1.4.4/docs/sbt-web-javadoc.jar
项目加载失败:(r)etry、(q)uit、(l)ast 还是 (i)gnore? q
【问题讨论】:
【参考方案1】:我能够解决问题。我的信任库中缺少证书链 (akamai.bintray.com) 中的一个证书。添加此证书后,SBT 项目编译工作。
repo.scala-sbt.org -> dl.bintray.com -> akamai.bintray.com
https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.8.2/jars/sbt-plugin.jar
【讨论】:
以上是关于与证书相关的 SBT 项目编译错误的主要内容,如果未能解决你的问题,请参考以下文章