2013-07-29 47 views
0

我試圖在播放框架中使用SBT子項目,並按照說明herePlay Framework 2.1.1在多項目設置中無法找到播放對象Build.scala

我創建了三個目錄,一個包含主要播放內容,一個目錄是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) 

} 

回答

0

確定播放插件是否正確裝入?沒有它,Play庫不能用於Build文件(或其他任何地方)。

如解釋hereproject/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")) 
相關問題