4

I forked btce-scala, so I can work on a trading bot. I'm cleaning up this library by adding the normal sbt project structure, making a build.sbt, etc:

~/code/scala/btce-scala) cat build.sbt
name := "btce-scala"

version := "0.1"

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

scalaVersion := "2.10.3"

libraryDependencies ++= Seq(
    "net.liftweb" % "lift-json_2.9.1" % "2.6-M2",
    "org.specs2" %%  "specs2" % "2.3.8" % "test",
    "joda-time" % "joda-time" % "2.3",
    "org.joda" % "joda-convert" % "1.6",
    "commons-codec" % "commons-codec" % "1.9",
    "com.typesafe.play" % "play_2.2.2" % "2.2.2"
)

My problem is that I'm not sure how to import the latest version of Play framework. I need it to use play.api.libs.ws.WS.

~/code/scala/btce-scala   sbt run
[info] Set current project to btce-scala (in build file:/Users/bryangarza/code/scala/btce-scala/)
[info] Updating {file:/Users/bryangarza/code/scala/btce-scala/}btce-scala...
[info] Resolving com.typesafe.play#play_2.2.2;2.2.2 ...
[warn]  module not found: com.typesafe.play#play_2.2.2;2.2.2
[warn] ==== local: tried
[warn]   /Users/bryangarza/.ivy2/local/com.typesafe.play/play_2.2.2/2.2.2/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/typesafe/play/play_2.2.2/2.2.2/play_2.2.2-2.2.2.pom
[warn] ==== Typesafe Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/com/typesafe/play/play_2.2.2/2.2.2/play_2.2.2-2.2.2.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.typesafe.play#play_2.2.2;2.2.2: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: com.typesafe.play#play_2.2.2;2.2.2: not found

...

[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.play#play_2.2.2;2.2.2: not found

Obviously this is because it can't find Play_2.2.2, but where can I find this repo so I can add it to sbt?

Emil
  • 447
  • 4
  • 18

1 Answers1

12

Your dependency is wrong. Use this instead:

libraryDependencies ++= Seq("com.typesafe.play" %% "play" % "2.2.2")
Rado Buransky
  • 3,252
  • 18
  • 25
  • 1
    It works for me. Have you used double %%? Also try "com.typesafe.play" % "play_2.10" % "2.2.2" – Rado Buransky Mar 06 '14 at 04:39
  • You're right, it was that I had `%` instead of `%%`. Sometimes it's the smallest errors that are hardest to fix. Thanks! By the way, any chance you could explain what `%%` does? I was reading the sbt docs but to me it was unclear. – Emil Mar 06 '14 at 04:46
  • 1
    My understanding is that `%%` finds a dependency that is compatible with your Scala version. So in your case (Scala 2.10.3) it will rewrite your dependency as I previously wrote to "com.typesafe.play" % "play_2.10" % "2.2.2". Have you had Scala version 6.6.6 then I believe it would be "com.typesafe.play" % "play_6.6.6" % "2.2.2". – Rado Buransky Mar 06 '14 at 04:52
  • 1
    If you use %%, then you dont have to specify _2.10. The sbt will try to download the play library for the scala version that you are using. In short what you have specified in sbt settings 'scalaVersion' – chauhraj Mar 06 '14 at 04:54
  • Cool, that's pretty useful to have. Thank you both for the answers. – Emil Mar 06 '14 at 05:29