Playframework 向sbt添加Play JSON库

Playframework 向sbt添加Play JSON库,playframework,sbt,playframework-2.1,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] :::

如何将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
。请注意,我的
解析器
包括。

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

addSbtPlugin(“播放“%”播放json“%”2.2-SNAPSHOT”)

您可能还必须包括以下解析器:

“Mandubian存储库快照”位于https://github.com/mandubian/mandubian-mvn/raw/master/snapshots/“


这里是我最初获得信息的地方:

使用SBT播放2.3 JSON>=0.13.5

放入build.sbt:

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.4"
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

scalaVersion := "2.10.2"

libraryDependencies += "play" % "play_2.10" % "2.1.0"
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

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

build.sbt:

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.4"
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

scalaVersion := "2.10.2"

libraryDependencies += "play" % "play_2.10" % "2.1.0"
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

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

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

Play 2.2已退出,可以与Play框架的其余部分分开添加。in build.sbt:

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.4"
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

scalaVersion := "2.10.2"

libraryDependencies += "play" % "play_2.10" % "2.1.0"
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.2.1"
这对我很有用(scala 2.11)

resolvers+=“类型安全回购”at”http://repo.typesafe.com/typesafe/releases/“

libraryDependencies+=“com.typesafe.play”%%“play json”%%“2.3.0”
可以检查以下内容并将其添加到
build.sbt
文件中:

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

嗯,我在添加1行程序时遇到了一个缺少依赖项的错误。有没有办法避免git链接?现在可以作为“com.typesafe.play”%%“play json”%%“2.2.0”真正独立使用。看到Mandubian在那篇博文链接中的评论“自从play 2.2,你不再需要我的回购协议了”,这正是我想要找到的——在你的答案上找到完美的时机+1.使用@Carolis的答案更新
build.sbt
后,请记住在
sbt
中重新加载@JeroenKransen我无法更改答案,它已锁定。非常好。但只适用于Scala 2.10(参见@Raul的答案,了解2.11+兼容性)。在撰写本文时,这是正确的,不是一个独立的库。不适用于我。使用SBT13.11。它找不到com.typesafe.play#play-json_2.10;2.3.4. 可能是因为我的scala版本是2.10.5。我不得不在Maven Central上添加typesafe repoon是这个版本:不得不为Play 2.3和SBT>0.13.5添加
resolvers+=…
行,然后重新加载。凯文,你能改变你的答案吗现在你能在游戏2.2中了。嗨,布兰克曼。我认为下面的处理方式是播放2.2,否?我无法编辑和更改答案,它似乎已被锁定。到目前为止,唯一适用于Scala 2.11的答案。我不需要添加冲突解决程序行。顺便说一下,当前版本是2.5.4,而不是2.3.0。