Adding Play JSON Library to sbt
Solution 1
Play 2.3 JSON with SBT >= 0.13.5
put into build.sbt:
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.4"
Play 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"
Play JSON is in Play 2.1 not an independent artifact.
Solution 2
Play 2.2 is out and can be added separately from rest of Play Framework. in build.sbt:
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.2.1"
Solution 3
This worked for me (scala 2.11)
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.0"
Solution 4
You can use the following to get the Play JSON library:
addSbtPlugin("play" % "play-json" % "2.2-SNAPSHOT")
You may also have to include the following resolver:
"Mandubian repository snapshots" at "https://github.com/mandubian/mandubian-mvn/raw/master/snapshots/"
Here's where I originally got the info: http://mandubian.com/2013/02/21/play-json-stand-alone/
Solution 5
One could check the Getting Started section of the GitHub repository and add the following to the build.sbt
file:
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.0-M1"
Related videos on Youtube
Kevin Meredith
Scala developer Haskell student https://www.linkedin.com/pub/kevin-meredith/11/22a/334
Updated on July 09, 2022Comments
-
Kevin Meredith almost 2 years
How can I add the Play JSON library (
play.api.libs.json
) to my sbt project?When I added the following to my
plugins.sbt
file:addSbtPlugin("play" % "sbt-plugin" % "2.1.0")
I faced this error:
[warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: play#sbt-plugin;2.1.0: not found [warn] ::::::::::::::::::::::::::::::::::::::::::::::
I did not find a resolver for this library, otherwise I would've added it and ran
sbt update
. Note that myresolvers
includes http://repo.typesafe.com/typesafe/releases/.-
Blankman almost 10 yearsKevin, can you change your answer b/c now you can in play 2.2.
-
Kevin Meredith over 9 yearsHi Blankman. I think that the below answer handles
play 2.2
, no? -
Blankman over 9 yearsI can't edit and change the answer, it seems to be locked.
-
-
Kevin Meredith over 10 yearsHmm I got a missing dependency error from adding the 1 liner. Any way to avoid the git link?
-
reggoodwin over 10 yearsNow available truly standalone as "com.typesafe.play" %% "play-json" % "2.2.0". See comment by Mandubian in that blog post link "since play 2.2, you don't need my repo anymore"
-
Stephen over 10 yearsJust what I wanted to find - Perfect timing on your answer!
-
Schleichardt about 10 yearsAt the time of writing this was true, not it is an independent lib.
-
Kevin Meredith almost 10 years+1. After updating your
build.sbt
with @Carolis's answer, remember to reload insbt
. -
Blankman over 9 years@JeroenKransen I can't change the answer, it is locked.
-
Brent Faust about 9 yearsExcellent. But only works with Scala 2.10 (see @Raul's answer for 2.11+ compatibility).
-
Brent Faust about 9 yearsThe only answer thus far that works with Scala 2.11.
-
BradLaney about 8 yearsDoesn't work for me. Using sbt 13.11. It cannot find com.typesafe.play#play-json_2.10;2.3.4. Probably due to me scala version being 2.10.5. I had to add the typesafe repo
-
Schleichardt about 8 yearson Maven Central is this version: search.maven.org/…
-
yair about 8 yearshad to add the
resolvers += ...
line even for Play 2.3 and SBT > 0.13.5, and reload. Then worked. -
ps0604 over 7 yearsI didn't need to add the resolvers line. By the way, current version is 2.5.4, not 2.3.0.