Here is the layout of my multi-project Play 2.2 application - I'm still trying to convert to build.sbt:
myApp
+ app
+ build.sbt
+ conf
| + routes
+ project
| + build.properties
| + Build.scala
| + plugin.sbt
+ modules
+ myModule
+ app
+ build.sbt
+ conf
+ routes
myApp/build.sbt:
name := "myApp"
version := "1.0-SNAPSHOT"
organization := "com.mydomain"
lazy val myModule = project.in(file("modules/myModule"))
lazy val main = project.in(file(".")).dependsOn(myModule).aggregate(myModule)
play.Project.playScalaSettings
resolvers ++= Seq(
Resolvers.typesafe,
Resolvers.sonatype
)
myApp/projects/Build.scala:
import sbt._
object Resolvers {
val sonatype = Resolver.sonatypeRepo("snapshots")
val typesafe = "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
}
myApp/modules/myModule/build.sbt:
name := "myModule"
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play" % "2.2.1" % "provided",
"org.reactivemongo" %% "reactivemongo" % "0.10.0-SNAPSHOT",
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.0-SNAPSHOT"
)
resolvers ++= Seq(
Resolvers.typesafe,
Resolvers.sonatype
)
I'm facing with two problems when trying to compile the project above:
1) Even if only the sub-project has dependencies (the main project is just a container for many sub-projects), I have to specify the resolvers
also in the main build file myApp/build.sbt
; if I don't, the project doesn't compile. This is not a blocking problem.. but I'd like to understand why.
2) Then, as soon as I try to compile the project, I always get the following error:
[error] /home/j3d/Projects/myApp/conf/routes:9: not found: value myModule
[error] -> /myModule myModule.Routes
[error] /home/j3d/Projects/myApp/conf/routes: not found: value myModule
[error] /home/j3d/Projects/myApp/conf/routes:12: not found: value myModule
[error] GET /assets/*file controllers.Assets.at(path="/public", file)
[error] /home/j3d/Projects/myApp/conf/routes:9: not found: value handler
[error] -> /myModule myModule.Routes
[error] four errors found
[error] (main/compile:compile) Compilation failed
[error] Total time: 12 s, completed Dec 1, 2013 6:34:55 PM
Here is myApp/conf/routes...
GET / controllers.Application.index
-> /myModule myModule.Routes
GET /assets/*file controllers.Assets.at(path="/public", file)
... and finally here is myApp/modules/myModule/conf/myModule.routes:
GET /myModule/greetings controllers.myModule.Greetings.hello
Am I missing something?