With the lastest release of
the Play Framework, the way
multi-project builds should be created has changed. Unfortunately this
change is yet to be documented. If you're following the docs but
seeing unexpected (and unwelcome) error messages along the lines of
object Project is not a member of package play
then read on. I spent
a while getting to the bottom of this, hopefully I can save you the
time.
Short answer
Play's documentation on migrating from 2.3.x to 2.4 has the answer.
Long answer
In the past the correct way to put a multi-project build was to use
the play.Project
function in place of sbt's own Project
constructor. the docs still say this is the correct approach but it
seems as of version 2.3.4
Play integrates more closely with sbt
.
Here's an example of how to convert a multi-project build definition
that uses the more powerful *.scala
format. I find for multi-project
builds that the scala
format is more useful but the same change
should apply to the simpler build.sbt
method of defining your
project's build.
import sbt._
import Keys._
import play.PlayScala
object ApplicationBuild extends Build {
name := """my-application"""
scalaVersion := "2.11.2"
version := "0.0.1-SNAPSHOT"
lazy val common = Project("common", file("common"))
.enablePlugins(PlayScala)
lazy val admin = Project("admin", file("admin"))
.enablePlugins(PlayScala)
.dependsOn(common)
lazy val web = Project("web", file("web"))
.enablePlugins(PlayScala)
.dependsOn(common)
}
You should now use the normal Project
constructor from sbt and if
you need it to behave like a Play application (use the Play directory
layout and make the various bits of Play available) then you can
include the PlayScala plugin using enablePlugin(PlayScala)
.