I installed the following: 1.Plate 2.4 2.Created a scala project 3. Added eclipse plugin
Now I wanted to add a database connection. I want to try ReactiveMongo, but the instructions on the wiki page are for 2.3 or older.
https://github.com/ReactiveMongo/Play-ReactiveMongo
For 2.4, it seems that the file structure of the game has changed. I need to know the correct way to configure play 2.4 for ReactiveMongo.
Here are the instructions they give for game versions, but no more than 2.4:
If you want to use the latest snapshot, add the following instead (only for play > 2.3): resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" libraryDependencies ++= Seq( "org.reactivemongo" %% "play2-reactivemongo" % "0.11.0-SNAPSHOT" ) Configure your application to use ReactiveMongo plugin add to your conf/play.plugins 1100:play.modules.reactivemongo.ReactiveMongoPlugin Configure your database access within application.conf
How do I apply this configuration to the new 2.4 playback file structure?
This is what I tried to do without success: In the /plugins.sbt project, I added:
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" addSbtPlugin("org.reactivemongo" % "play2-reactivemongo" % "0.11.0-SNAPSHOT")
I get a permission error message:
at java.lang.Thread.run(Thread.java:745) [error] (*:update) sbt.ResolveException: unresolved dependency: org.reactivemong o#play2-reactivemongo;0.11.0-SNAPSHOT: not found
So, after learning that I need to add a dependency to the /build.sbt file and made changes there.
name := """oneid-scala""" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayScala) scalaVersion := "2.11.6" libraryDependencies ++= Seq( jdbc, cache, ws, specs2 % Test ) resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases" //This is for reactivemongodb resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" //This is for reactivemongodb libraryDependencies ++= Seq( "org.reactivemongo" %% "play2-reactivemongo" % "0.11.0-SNAPSHOT" ) // Play provides two styles of routers, one expects its actions to be injected, the // other, legacy style, accesses its actions statically. routesGenerator := InjectedRoutesGenerator EclipseKeys.createSrc := EclipseCreateSrc.All
After completing these steps, I want to verify that the installation is correct. So I tried to add the tutorial code to my project from https://github.com/ReactiveMongo/Play-ReactiveMongo
/app /controllers/Application.scala /controllers/UsingJsonReadersWriters.scala /models/models.scala /conf /routes
Then I activate the activator. Then I launch the activator.
I see an error after starting:
missing or invalid dependency detected while loading class file 'JSONGenericHandlers.class'. Could not access type GenericHandlers in package reactivemongo.api.collections, because it (or its dependencies) are missing. Check your build definition for missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) A full rebuild may help if 'JSONGenericHandlers.class' was compiled against an incompatible version of reactivemongo.api.collections.
So, it seems that my installation failed. So this question is still open.