如何使用build.sbt(而不是Build.scala)将SecureSocial添加到Play 2.x项目

时间:2013-12-06 08:14:02

标签: playframework-2.0 sbt

我是Play的新手! 2.x和sbt,并且为了增加混淆,他们对依赖关系的文档与他们在Activator中完成示例项目的方式不同。特别是,我正在使用hello-play模板项目。

没有Build.scala个文件,但有build.sbt个文件。我试图在Installation文档后面添加SecureSocial模块。

build.sbt文件如下所示:

name := """hello-play"""

version := "1.0-SNAPSHOT"

resolvers += "sbt-plugin-snapshots" at "http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"

libraryDependencies ++= Seq(
  javaCore,  // The core Java API
  "org.webjars" %% "webjars-play" % "2.2.0",
  "org.webjars" % "bootstrap" % "2.3.1",
  "securesocial" %% "securesocial" % "2.1.2"
)

play.Project.playScalaSettings

在编译时,它显示它尝试使用我给的解析器,但没有运气:

[warn] ==== sbt-plugin-snapshots: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/securesocial/securesocial_2.10/2.1.2/securesocial_2.10-2.1.2.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: securesocial#securesocial_2.10;2.1.2: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: securesocial#securesocial_2.10;2.1.2: not found

我做错了吗?不知道还有什么可以尝试。

1 个答案:

答案 0 :(得分:9)

Play Framework 2.2将默认构建定义从Build.scala切换为build.sbt,而SecureSocial尚未更新其文档。但是你几乎得到了它。只需将resolvers行更改为:

即可
resolvers += Resolver.url("sbt-plugin-releases", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)