代码之家  ›  专栏  ›  技术社区  ›  dave4420

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

  •  1
  • dave4420  · 技术社区  · 5 年前

    我有一个 fairly minimal example

    特别是,这是我的 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
    

    $ /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

    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.
    

    我有马科斯莫哈韦10.14.5。

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

    0 回复  |  直到 5 年前
        1
  •  1
  •   Mario Galic    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