2014-03-06 106 views
3

我分叉了btce-scala,所以我可以在交易機器人上工作。我加入正常SBT項目結構,使得build.sbt等清理這個庫:如何導入Play框架作爲Scala項目的依賴項

~/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" 
) 

我的問題是,我不知道如何導入最新版本的遊戲框架。我需要它使用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 

顯然,這是因爲它無法找到Play_2.2.2,但我在哪裏可以找到這種回購,所以我可以把它添加到SBT?

回答

7

您的依賴是錯誤的。用這個代替:

libraryDependencies ++= Seq("com.typesafe.play" %% "play" % "2.2.2") 
+0

我試過了,結果也一樣。 – Emil

+1

它適合我。你用過雙%%嗎?也請嘗試使用「com.typesafe.play」%「play_2.10」%「2.2.2」 –

+0

你是對的,它是我用'%'代替'%%'。有時候,這是最難解決的最小錯誤。謝謝!順便說一句,你可以解釋'%%'做什麼的機會?我正在閱讀sbt文檔,但對我來說目前還不清楚。 – Emil

相關問題