tminglei
tminglei

Reputation: 53

How to add play-json dependency to project?

I want to add play-json dependency to a sbt project.

I added Typesafe repository in project/plugins.sbt:

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

Then I added play-json dependency in Build.scala as follows:

libraryDependencies += "com.typesafe.play" % "play-json_2.10" % "2.2.1"

With this, I got error as follows:

[warn]  module not found: com.typesafe.play#play-json_2.10;2.2.1
[warn] ==== local: tried
[warn]   /home/tminglei/.ivy2/local/com.typesafe.play/play-json_2.10/2.2.1/ivys/ivy.xml
[warn] ==== sonatype-snapshots: tried
[warn]   https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/play/play-json_2.10/2.2.1/play-json_2.10-2.2.1.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/typesafe/play/play-json_2.10/2.2.1/play-json_2.10-2.2.1.pom
[info] Resolving org.scala-tools.testing#test-interface;0.5 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.typesafe.play#play-json_2.10;2.2.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

How to sort it out?

Upvotes: 3

Views: 3882

Answers (2)

ed.
ed.

Reputation: 2706

It looks like its not using the resolver you defined. This works for me in sbt 13:

import sbt._
import Keys._

object Build extends sbt.Build {

  lazy val playjsondep = Project(
    id = "play-json-dep",
    base = file("."),
    settings = Project.defaultSettings ++ Seq(
      name := "play-json-dep",
      organization := "ee.so",
      version := "0.1-SNAPSHOT",
      scalaVersion := "2.10.2",
      resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
      libraryDependencies += "com.typesafe.play" %% "play-json" % "2.2.1"
    )
  )
}

Upvotes: 3

Jacek Laskowski
Jacek Laskowski

Reputation: 74619

Since the dependency is not a plugin, you should only add resolvers setting to build.sbt in the home directory of your project.

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

You really need no project/*.scala files for such a simple configuration.

Upvotes: 8

Related Questions