将Play JSON库添加到sbt

时间:2013-10-17 19:58:22

标签: playframework sbt playframework-2.1

如何将Play JSON库(play.api.libs.json)添加到我的sbt项目中?

当我将以下内容添加到我的plugins.sbt文件中时:

addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

我遇到了这个错误:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: play#sbt-plugin;2.1.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

我找不到这个库的解析器,否则我会添加它并运行sbt update。请注意,我的resolvers包含http://repo.typesafe.com/typesafe/releases/

5 个答案:

答案 0 :(得分:77)

Play 2.2已经发布,可以与Play Framework的其余部分分开添加。在build.sbt:

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

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.2.1"

答案 1 :(得分:37)

使用SBT播放2.3 JSON> = 0.13.5

投入build.sbt:

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.4"

播放2.1

build.sbt:

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

scalaVersion := "2.10.2"

libraryDependencies += "play" % "play_2.10" % "2.1.0"

播放JSON在Play 2.1中不是一个独立的工件。

答案 2 :(得分:11)

这对我有用(scala 2.11)

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

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.0"

答案 3 :(得分:1)

您可以使用以下内容获取Play JSON库:

addSbtPlugin("play" % "play-json" % "2.2-SNAPSHOT")

您可能还需要包含以下解析程序:

"Mandubian repository snapshots" at "https://github.com/mandubian/mandubian-mvn/raw/master/snapshots/"

这是我最初获取信息的地方:http://mandubian.com/2013/02/21/play-json-stand-alone/

答案 4 :(得分:1)

可以检查the Getting Started section of the GitHub repository并将以下内容添加到build.sbt文件中:

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.0-M1"