为什么 SBT 不能解决 SecureSocial-snapshot 依赖?

Why can’t SBT resolve SecureSocial-snapshot dependency?

我想为我的项目使用这个 SecureSocial 快照:

https://oss.sonatype.org/content/repositories/snapshots/ws/securesocial/securesocial_2.11/master-SNAPSHOT/

但是SBT无法解决。这是错误消息:

[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/ws/securesocial/securesocial_2.11/master-SNAPSHOT/securesocial_2.11-master-SNAPSHOT.pom
[warn] ==== typesafe-releases: tried
[warn]   http://repo.typesafe.com/typesafe/releases/ws/securesocial/securesocial_2.11/master-SNAPSHOT/securesocial_2.11-master-SNAPSHOT.pom
[warn] ==== typesafe-ivy-releasez: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/ws.securesocial/securesocial_2.11/master-SNAPSHOT/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn]   https://repo.typesafe.com/typesafe/releases/ws/securesocial/securesocial_2.11/master-SNAPSHOT/securesocial_2.11-master-SNAPSHOT.pom
[info] Resolving jline#jline;2.12 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: ws.securesocial#securesocial_2.11;master-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

这是我的解析器和库依赖项:

Build.scala:

libraryDependencies ++= Seq(
  "org.webjars" %% "webjars-play" % "2.3.0-3",
  "org.logback-extensions" % "logback-ext-loggly" % "0.1.2",
  "ws.securesocial" % "securesocial_2.11" % "master-SNAPSHOT"
)

plugins.sbt:

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"

据我所知,这应该可行,但事实并非如此。这个问题的原因是什么?

版本信息:

您为库添加的解析器应该放在 build.sbt 中,而不是 plugins.sbt 中。这两个文件没有级联,如果您看到 sbt 的输出,它甚至不会尝试连接到 Sonatype。在 build.sbt 中移动这一行,它应该可以工作:

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"

值得注意的是,只有当您想包含不在默认存储库中的 sbt 插件时,才需要在 plugins.sbt 中添加解析器。