0
votes

I'm trying to use an SBT sub project with the Play Framework and I followed the instructions here.

I created the three directories, one containing the main play stuff, one dir being the sbt sub-project, and the last being the project directory with the Build.scala file.

At first I had problems with unresolved dependencies which was fixed with a build.properties file but now it doesn't want to include the play api when compiling the Build.scala file.

[info] Loading project definition from 
/home/caskman/ScalaProjects/CorpusBrowserMultiTest/project
[info] Updating
{file:/home/caskman/ScalaProjects/CorpusBrowserMultiTest/project/}default-20bdad..
[info] Resolving org.scala-sbt#precompiled-2_10_0-m7;0.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to
/home/caskman/ScalaProjects/CorpusBrowserMultiTest/project/target/scala-2.9.2/sbt0.12/classes...
[error] /home/caskman/ScalaProjects/CorpusBrowserMultiTest/project/Build.scala:3: not found: object play
[error] import play.Project._
[error]        ^
[error] one error found

Here's Build.scala

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "PlayProject"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    // Add your project dependencies here,
    jdbc,
    anorm
  )

  val subProject = Project("subProject",file("subProject-dir"))


  val main = play.Project(appName, appVersion, appDependencies, path = file("playProject"))
    .dependsOn(subProject)

}
1

1 Answers

0
votes

Are you sure the Play plugin is correctly loaded ? Without it, the Play library cannot be used in the Build file (or anywhere else).

As explained here, the project/plugins.sbt file must contain the plugin definition.

You can look at these samples to have working examples of this file:

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % Option(System.getProperty("play.version")).getOrElse("2.0"))