scala - 通过 SBT 下载插件时如何修复 SSL 错误?

标签 scala jvm sbt ssl-certificate

我有一个 fairly minimal example SBT项目。

特别是,这是我的project/plugins.sbt:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")

这是我的project/build.properties:

sbt.version = 1.2.8

加载我的项目时我在 SBT 中遇到的错误是这样开始的:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.eed3si9n#sbt-assembly;0.14.9: Resolution failed several times for dependency: com.eed3si9n#sbt-assembly;0.14.9 {compile=[default(compile)]}::
[warn]  typesafe-ivy-releases: unable to get resource for com.eed3si9n#sbt-assembly;0.14.9: res=https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.9/ivys/ivy
.xml: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certificat
ion path to requested target
[warn]  sbt-plugin-releases: unable to get resource for com.eed3si9n#sbt-assembly;0.14.9: res=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.9/iv
ys/ivy.xml: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid cert
ification path to requested target
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]          com.eed3si9n:sbt-assembly:0.14.9 (scalaVersion=2.12, sbtVersion=1.0)
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]          com.eed3si9n:sbt-assembly:0.14.9 (scalaVersion=2.12, sbtVersion=1.0) (/Users/dah/vc/noddy-akka-http/project/plugins.sbt#L1-2)
[warn]            +- default:noddy-akka-http-build:0.1.0-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)

结束

[error] (update) sbt.librarymanagement.ResolveException: unresolved dependency: com.eed3si9n#sbt-assembly;0.14.9: Resolution failed several times for dependency: com.eed3si9n#sbt-assembly;0.14.9 {compile=
[default(compile)]}::
[error]         typesafe-ivy-releases: unable to get resource for com.eed3si9n#sbt-assembly;0.14.9: res=https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.9/
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.eed3si9n#sbt-assembly;0.14.9: res=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.9/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

这是我安装的 JVM 版本:

$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

虽然,当我运行 sbt console(从没有 SBT 项目的目录)时,我得到:

Welcome to Scala version 2.10.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_31).
Type in expressions to have them evaluated.
Type :help for more information.

我有 macOS Mojave 10.14.5。

我想我需要更新我的证书库。我该怎么做?

或者我应该做些其他事情来解决这个问题吗?

最佳答案

通过执行 sbt 控制台仔细检查 sbt 使用的 java 版本。它应该说类似 Welcome to Scala 2.12.7 (OpenJDK 64-Bit Server VM, Java 1.8.0_202)。就个人而言,我建议清理当前安装并尝试 adoptopenjdk8像这样

brew cask install adoptopenjdk8

关于scala - 通过 SBT 下载插件时如何修复 SSL 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56841928/

相关文章:

java - 无法启动 Eclipse - JVM 终止。退出代码=1

java - Java如何在多态中确定运行时调用的方法?

java - 为 Kafka 编译自定义生产者

java - Java Play SBT 中的 IntelliJ 更新后项目名称无效

scala - 如何使用 Scala 项目运行 sbt-revolver?

scala - 泛型中奇怪的嵌套结构类型

scala - 将 Scala 结构类型与抽象类型一起使用

java - 如何从编译时未知的索引处的局部变量加载引用?

image - 单色位图

syntax - 何时可以省略括号、点、大括号、=(函数)等,具体规则是什么?