I'm trying to create a multi-project SBT build definition. I'm having trouble executing the run
command on my root project.
The folder structure is the following:
RootProjectFolder
|
|- build.sbt
|- project
|
|-Build.scala
|-plugins.sbt
|
| - play-webapp
The contents of the Build.scala
file is:
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "project-name"
val appVersion = "0.1.0-SNAPSHOT"
lazy val root = Project(id = appName + "-root",
base = file(".")
).aggregate(webApp)
lazy val webApp = play.Project(
appName + "-website", appVersion, path = file("play-webapp")
)
}
When I launch SBT I get the following message: Set current project to project-name-root
which implies that the root project was detected correctly.
When I execute the run
command I get the following error message
> run
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last project-name-root/compile:run for the full output.
[error] (project-name-root/compile:run) No main class detected.
The error message is correct in saying that the root project does not have any classes, but the play-webapp project has. I assumed that the result would be to run the play app.
If I type project play-webapp
before run
everything seems to be ok.
Is this the correct behavior? Or am I doing something wrong?
P.S. I'm using SBT version 0.13 and scala version 2.10.3