Reputation: 16148
I am trying to use the java mongo driver with Play!.
So I read though:
http://www.playframework.org/documentation/2.0.2/SBTDependencies
http://www.mongodb.org/display/DOCS/Java+Tutorial
I added the buildpath in eclipse. But play can't find the dependency.
So there is an example on the playframework homepage but I still can't figure it out.
val appDependencies = Seq(
"org.scala-tools" %% "scala-stm" % "0.3",
"org.apache.derby" % "derby" % "10.4.1.3" % "test"
)
Why are der two% signs? How do I get the correct names? I only know that the version should be 2.8.0. So if I want to add the Java driver, what do I have to do?
And if i use the official java driver, I don't have to use Morphia right?
Installing play framework mongodb morphia module
.
.
Edit:
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "website"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
"org.mongodb" % "mongo-java-driver" % "2.8.0"
//"com.mongodb" % "Mongo" %"2.8.0"
)
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
// Add your own project settings here
)
}
Upvotes: 2
Views: 7950
Reputation: 412
In case the accepted answer doesn't work for some of you , you can try adding this version of mongodb in the build.sbt
"org.mongodb.morphia" % "morphia" % "0.107"
Upvotes: 0
Reputation: 665
I use reactive-mongo for my project. You can find some information here http://reactivemongo.org/releases/0.10.5/documentation/tutorial/setup.html
Upvotes: 1
Reputation: 21564
To add the MongoDB drivers to your Play project, edit your project/Build.scala
file to add the MongoDB dependency:
val appDependencies = Seq(
// ... here are your previous dependencies (derby etc...)
"org.mongodb" % "mongo-java-driver" % "2.8.0"
)
After you add this, you need to restart your Play server for the changes to take affect.
Upvotes: 5