如何声明play json依赖?
How to declare play json dependency?
我的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
如何为我的 scala 2.11.6
获取这个 play-json 库?
您可以查看 com.typesafe.play
的所有 play-json
版本 here。他们没有 2.3.4
版本;尝试改用 2.4.0-M3
。
"com.typesafe.play" %% "play-json" % "2.4.0-M3"
注意双重 %%
,以便正确使用 scalaVersion
来解决依赖关系。
你需要告诉 sbt 应该使用哪个 scala 版本。
你可以是明确的:
"com.typesafe.play" % "play-json_2.11" % "2.3.4",
或者使用 %%
(sbt doc) 如下告诉 sbt 使用 scalaVersion
:
"com.typesafe.play" %% "play-json" % "2.3.4",
我的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
如何为我的 scala 2.11.6
获取这个 play-json 库?
您可以查看 com.typesafe.play
的所有 play-json
版本 here。他们没有 2.3.4
版本;尝试改用 2.4.0-M3
。
"com.typesafe.play" %% "play-json" % "2.4.0-M3"
注意双重 %%
,以便正确使用 scalaVersion
来解决依赖关系。
你需要告诉 sbt 应该使用哪个 scala 版本。
你可以是明确的:
"com.typesafe.play" % "play-json_2.11" % "2.3.4",
或者使用 %%
(sbt doc) 如下告诉 sbt 使用 scalaVersion
:
"com.typesafe.play" %% "play-json" % "2.3.4",