Reputation: 487
I'm trying to use mongo with Scala Play 2.5
I created a basic project from a template from the Play website. I'm now trying to create a class that imports the mongo module and I'm getting the following error:
object modules is not a member of package play
at this line:
import play.modules.reactivemongo.ReactiveMongoApi
I've enabled mongo in my application.conf
like so:
play.modules {
enabled += "play.modules.reactivemongo.ReactiveMongoModule"
}
and I've also added:
libraryDependencies += "org.reactivemongo" %% "play2-reactivemongo" % "0.11.14"
to build.sbt
Am I missing something?
Any ideas?
Why does it not find the "modules" package?
Upvotes: 2
Views: 3178
Reputation: 487
Ok, so here's the solution. Once the build config files are updated, you need to restart sbt. Otherwise it doesn't recognise the new dependencies.
Upvotes: 1
Reputation: 380
This looks like a problem with resolving relative imports. Do you have any other imports before
import play.modules.reactivemongo.ReactiveMongoApi
?
Quick fix would be to use an absolute import:
import _root_.play.modules.reactivemongo.ReactiveMongoApi
Upvotes: 0