I want to set-up an admin area as a sub-project in the Play Framework (2.6) so have been using this documentation but am coming up with a compilation error that I just can't fix:
[error] ...conf\routes:15: not found: value admin
[error] -> /admin admin.Routes
This is my project structure:
main-project
_build.sbt
_app
_controllers
_models
_views
_conf
_application.conf
_routes
_modules
_admin
_build.sbt
_app
_controllers
_models
_views
_conf
_admin.routes
_project
_build.properties
_plugins.sbt
main-project/build.sbt
import play.sbt.routes.RoutesKeys
name := "main-project"
val defaultResolvers = Seq(
Resolver.sonatypeRepo("snapshots")
)
lazy val commonSettings = Seq(
organization := "com.boardrs",
version := "1.0-SNAPSHOT",
scalaVersion := "2.12.2",
scalacOptions ++= Seq("-feature", "-language:postfixOps"),
resolvers ++= defaultResolvers
)
lazy val admin = (project in file("modules/admin"))
.settings(
commonSettings
).enablePlugins(PlayScala)
lazy val root = (project in file("."))
.settings(
commonSettings
)
.enablePlugins(PlayScala)
routesGenerator := InjectedRoutesGenerator
RoutesKeys.routesImport += "play.modules.reactivemongo.PathBindables._"
libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.0.0" % Test
libraryDependencies += "com.h2database" % "h2" % "1.4.194"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.0"
libraryDependencies += ws
// Play 2.6.x
libraryDependencies ++= Seq(
"org.reactivemongo" %% "play2-reactivemongo" % "0.12.5-play26"
)
libraryDependencies += "org.webjars" % "bootstrap" % "3.1.1-2"
main-project/modules/admin/build.sbt
name := "admin"
PlayKeys.devSettings += "play.http.router" -> "admin.Routes"
main-project/conf/routes (the file that contains the line referenced in the error)
# home page
GET / controllers.HomeController.index
-> /admin admin.Routes
GET /assets/*file controllers.Assets.at(path="/public", file)
main-project/modules/admin/conf/admin.routes
GET /index controllers.admin.HomeController.index()
GET /assets/*file controllers.admin.Assets.versioned(path="/public/lib/admin", file)
I have carefully looked here (on Stack Overflow) and elsewhere for a solution, e.g. this question is very similar but the answer incorporates techniques that have since been deprecated. I have tried multiple combinations but the Play Framework is a delicate beast; susceptible to a multitude of configuration and compatibility issues - so I don't feel as if I am honing in on the answer on my own. Can anyone see what I can't? Thanks