47

如何将 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/

4

5 回答 5

78

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

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

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.2.1"
于 2013-12-09T16:20:18.747 回答
40

使用 SBT >= 0.13.5 播放 2.3 JSON

放入 build.sbt:

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

玩 2.1

构建.sbt:

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

scalaVersion := "2.10.2"

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

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

于 2013-10-17T22:00:27.993 回答
13

这对我有用(scala 2.11)

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

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

于 2014-08-15T14:28:26.750 回答
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/

于 2013-10-17T20:02:42.433 回答
1

可以检查GitHub 存储库的入门部分并将以下内容添加到build.sbt文件中:

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.0-M1"
于 2017-05-25T12:56:08.393 回答