Stephan Rozinsky
Stephan Rozinsky

Reputation: 623

How to declare play json dependency?

My build.sbt file (sbt version is 0.13.8):

lazy val commonSettings = Seq(
  version := "1.0.0",
  scalaVersion := "2.11.6"
)

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

lazy val root = (project in file(".")).
  settings(commonSettings: _*).
  settings(
    name := "myapp",
    libraryDependencies ++= Seq(
      "com.typesafe.play" % "play-json" % "2.3.4",
      "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
      "junit" % "junit" % "4.12" % "test"
    )
  )

scalacOptions ++= Seq("-unchecked", "-feature", "-deprecation")

I get this error when trying to compile my project:

[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.play#play-json_2.11;2.3.4: not found
[error] Total time: 0 s, completed Apr 17, 2015 5:59:28 PM

How can I get this play-json library for my scala 2.11.6?

Upvotes: 1

Views: 2266

Answers (2)

Zeimyth
Zeimyth

Reputation: 1395

You can see all of com.typesafe.play's play-json versions here. They don't have a 2.3.4 version; try using 2.4.0-M3 instead.

"com.typesafe.play" %% "play-json" % "2.4.0-M3"

Mind the double %% so scalaVersion is used properly to resolve the dependency.

Upvotes: 4

moliware
moliware

Reputation: 10278

You need to tell sbt which scala version should use.

You can either be explicit:

"com.typesafe.play" % "play-json_2.11" % "2.3.4",

Or use %% (sbt doc) as follows to tell sbt to use scalaVersion :

"com.typesafe.play" %% "play-json" % "2.3.4",

Upvotes: 6

Related Questions