In my build.sbt
:
lazy val commonSettings = Seq(
version := "1.0.0",
scalaVersion := "2.11.6"
)
lazy val root = (project in file(".")).
settings(commonSettings: _*).
settings(
name := "myapp",
libraryDependencies ++= Seq(
"com.typesafe.play" % "play-json_2.11" % "2.3.4",
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
"junit" % "junit" % "4.12" % "test"
)
)
resolvers ++= Seq("Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/")
It compiles well. Now in code I use import play.api.libs.json._
but the compiler gives error saying "not found: object play". Obviously I did not install play. Is it possible to use play-json
library without installing Play?
Consider this simple sbt project:
build.sbt
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.3.4"
)
resolvers ++= Seq("Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/")
Then you can run:
sbt console
import play.api.libs.json._
Json.parse("{}")
> res0: play.api.libs.json.JsValue = {}
Yes, you can have play-json without Play. If it is not working in your project, try restarting SBT or do clean, reload, update, compile in SBT.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With