升级 SBT 时出错

Errors Upgrading SBT

我正在尝试将我的 Scala Play Framework 应用程序升级到 2.8,这涉及将 SBT 升级到 1.x。

在我的 build.propeties 我有 sbt.version=1.3.5

plugins.sbt我有

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.4")

但是,我看到了以下内容:

[warn] insecure HTTP request is deprecated 'http://repo.typesafe.com/typesafe/releases'; switch to HTTPS or opt-in as ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'http://repo.typesafe.com/typesafe/releases'; switch to HTTPS or opt-in as ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'http://repo.typesafe.com/typesafe/releases'; switch to HTTPS or opt-in as ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true)
[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.4 (sbtVersion=1.0, scalaVersion=2.12)
[error] sbt.librarymanagement.ResolveException: Error downloading com.typesafe.play:sbt-plugin;sbtVersion=1.0;scalaVersion=2.12:2.7.4
[error]   Not found
[error]   Not found
[error]   not found: https://repo1.maven.org/maven2/com/typesafe/play/sbt-plugin_2.12_1.0/2.7.4/sbt-plugin-2.7.4.pom
[error]   not found: /Users/Neil/.ivy2/local/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.4/ivys/ivy.xml
[error]   not found: /Users/Neil/.activator/repository/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.4/ivys/ivy.xml
[error]   not found: /usr/local/activator-1.3.6/repository/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.4/ivys/ivy.xml
[error]   not found: http://dl.bintray.com/heroku/sbt-plugins/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.4/ivys/ivy.xml
[error]   not found: http://dl.bintray.com/neomaclin/maven/com/typesafe/play/sbt-plugin_2.12_1.0/2.7.4/sbt-plugin-2.7.4.pom
[error]   download error: Caught 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 (sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target) while downloading https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.4/ivys/ivy.xml
[error]   download error: Caught 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 (sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target) while downloading https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/sbt-plugin/scala_2.12/sbt_1.0/2.7.4/ivys/ivy.xml

这是我的解析器:

resolvers += Resolver.typesafeRepo("releases")
resolvers += Resolver.typesafeIvyRepo("releases")
resolvers += Resolver.sbtPluginRepo("releases")
resolvers += Resolver.url("heroku-sbt-plugin-releases", url("http://dl.bintray.com/heroku/sbt-plugins/"))(Resolver.ivyStylePatterns)
resolvers += Resolver.bintrayRepo("neomaclin", "maven")

是什么导致所有这些关于使用 https 的警告?更重要的是,当我查找那些 ivy.xml 文件时,我得到了 404,但显然是控制台中的那些 PKIX 错误。当我不在代理后面时,为什么我会得到那些?我想我使用了错误的坐标,但我不知道它们是怎么错的。

为避免这些错误,请确保您有权访问您需要访问的存储库。此外,确保您的 sbt 凭据文件包含用于访问这些存储库的凭据。有多种设置方法,可以通过 IntelliJ preferences > build, Execution, Deployments > sbt~/.sbt/.credentials

对我有用的是将我的 JDK 升级到 11,因为 Java 的那个版本在其信任库中有发出 SBT 想要发出的请求所必需的证书。