0

我正在尝试将 SBT 子项目与 Play Framework 一起使用,并按照此处的说明进行操作。

我创建了三个目录,一个包含主要播放内容,一个目录是 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)

}
4

1 回答 1

0

您确定 Play 插件已正确加载吗?没有它,Play 库就不能在 Build 文件(或其他任何地方)中使用。

如此处所述,该project/plugins.sbt文件必须包含插件定义。

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

// 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"))
于 2013-07-29T22:17:04.280 回答