简体   繁体   中英

Cannot add ReactiveMongo to Play-Framework

ers,

I am having troubles with integrating the ReactiveMongo within the Play framework. My build.sbt

libraryDependencies ++= Seq(
  "org.reactivemongo" %% "play2-reactivemongo" % "0.9"
)

When I try to run the server with the play run command I get the following error:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.reactivemongo#play2-reactivemongo_2.9.2;0.9: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.reactivemongo#play2-eactivemongo_2.9.2;0.9: not found

The think that goes wrong is clear; it is looking for the 2.9.2 Scala version of the library. I have no idea why SBT is looking for 2.9, I have 2.10 installed. I have tried on several machines.

$ scalac -version
Scala compiler version 2.10.2 -- Copyright 2002-2013, LAMP/EPFL

and

$ play    
play! 2.1.3 (using Java 1.7.0_25 and Scala 2.10.0), http://www.playframework.org

Does anyone know how to solve this problem?

Are you sure you're not using a Play2.0 application ? Even if the play command-line indicates 2.1.3, the application you're trying to start might be a 2.0 one. Please check project/plugins.sbt file for a line like

addSbtPlugin("play" % "sbt-plugin" % "2.1.3")

If play tries to search for a 2.9.2 version of reactivemongo then play is using 2.9.2 version of scala (and thus it look like you're using a 2.0 version)

Reactive Mongo requires Scala 2.10 and you're trying to get it with 2.9. http://search.maven.org/#search%7Cga%7C1%7Creactivemongo

try (note the % instead of %% ):

"org.reactivemongo" % "play2-reactivemongo_2.10" % "0.9"
With single % instead of %% , dependency is not found ...i have changed my

scala version and now things are working fine , below is my build.sbt snapshot:

scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
  "org.reactivemongo" % "play2-reactivemongo_2.10" % "0.10.2"
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM