Scala和reactivemongo一起玩,没有工作

时间:2018-04-19 20:25:51

标签: scala playframework

我正在尝试跟随此tutorial,我无法让反应性工作:

这是我的错误:

  UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.reactivemongo#play2-reactivemongo_2.12;0.11.7.play24: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]      org.reactivemongo:play2-reactivemongo_2.12:0.11.7.play24 (/Users/jwan/Desktop/programming/scala_play/rest-api/build.sbt#L12-20)

这是我的built.sbt

name := """rest-api"""
organization := "com.example"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.12.4"

libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test,
  "org.reactivemongo" %% "play2-reactivemongo" % "0.11.7.play24",
  "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
)

// Adds additional packages into Twirl
//TwirlKeys.templateImports += "com.example.controllers._"

// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "com.example.binders._"

这是我的application.conf

# https://www.playframework.com/documentation/latest/Configuration

play.modules.enabled += "play.modules.reactivemongo.ReactiveMongoModule"

mongodb.uri = "mongodb://localhost:27017/getting-started-play-scala"

我无法让sbt run工作。有什么想法吗?

1 个答案:

答案 0 :(得分:2)

根据https://mvnrepository.com/artifact/org.reactivemongo/play2-reactivemongo

对于reactivemongo 0.11.7.play24,必需的scala版本为2.11。 尝试0.13.0-play26 for scalaVersion:=" 2.12.4"并且玩26。

libraryDependencies + =" org.reactivemongo" %%" play2-reactivemongo" %" 0.13.0-play26"