1
我正在編寫一個任務,將幾個但不是全部的子項目打包在一起,並使用排除設置和task.all(scope filter)
來選擇項目。然而,sbt總是說References undefined settings at runtime
。如何選擇子項目在運行時打包(使用ScopeFilter)?
這裏是項目/ build.scala我用跟隨有錯誤,我需要你的建議:
import sbt._
import Keys._
object build extends Build {
lazy val root = Project(
id = "root",
base = file("."),
aggregate = Seq(a,b),
settings = Seq(
exclude := Seq(a),
module := moduleImpl.value,
modules := modulesImpl.value
)
)
lazy val a = Project(
id = "a",
base = file("a")
)
lazy val b = Project(
id = "b",
base = file("b")
)
val exclude = settingKey[Seq[ProjectReference]]("excludes")
val module = taskKey[String]("module")
val modules = taskKey[Seq[String]]("modules")
def moduleImpl = Def.task {
projectID.value.organization
}
def modulesImpl = Def.taskDyn {
module.all(ScopeFilter(inAggregates(ThisProject) -- inProjects(exclude.value: _*)))
}
}
這是我真的想擺脫的錯誤:
> show modules
[trace] Stack trace suppressed: run last root/*:modules for the full output.
[error] (root/*:modules) sbt.Init$RuntimeUndefined: References to undefined settings at runtime.
[error] Total time: 0 s, completed 2014-06-12 16:48:05
任何想法解決這個問題?