1

我的build.sbt文件(sbt 版本是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")

尝试编译我的项目时出现此错误:

[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

我怎样才能得到这个 play-json 库scala 2.11.6

4

2 回答 2

6

你需要告诉 sbt 应该使用哪个 scala 版本。

您可以是明确的:

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

或者使用%%( sbt doc ) 如下告诉 sbt 使用scalaVersion

"com.typesafe.play" %% "play-json" % "2.3.4",
于 2015-04-17T18:29:16.427 回答
4

你可以在这里看到所有com.typesafe.playplay-json版本。他们没有版本;尝试改用。2.3.42.4.0-M3

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

注意双重%%所以scalaVersion正确使用来解决依赖关系。

于 2015-04-17T17:19:51.737 回答