Play Framework 2.1.1在多项目设置Build.scala中找不到播放对象

时间:2013-07-29 18:00:54

标签: scala playframework-2.1

我正在尝试使用Play框架的SBT子项目,我按照here的说明进行操作。

我创建了三个目录,一个包含主要播放内容,一个目录是sbt子项目,最后一个是带有Build.scala文件的项目目录。

首先,我遇到了使用build.properties文件修复的未解析依赖项的问题,但现在它不希望在编译Build.scala文件时包含play api。

[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

这是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 个答案:

答案 0 :(得分:0)

你确定Play插件已正确加载吗?没有它,Play库不能用于构建文件(或其他任何地方)。

正如here所述,project/plugins.sbt文件必须包含插件定义。

您可以查看these samples以获取此文件的工作示例:

// 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"))