我有以下项目定义(简化):
object B extends Build {
lazy val root = (project in file("."))
.aggregate(commons, processor)
lazy val commons = (project in file("commons"))
lazy val processor = (project in file("processor"))
.enablePlugins(BuildInfoPlugin, BuildTag)
}
和BuildTag
插件(也简化为手头的问题):
object BuildTag extends AutoPlugin {
override def requires = BuildInfoPlugin
override lazy val buildSettings = Seq(
packageOptions in (Compile, packageBin) += {
Package.ManifestAttributes(("buildinfo.package", (buildInfoPackage in Compile).value))
}
)
}
当我加载项目时,我收到如下错误:
Reference to undefined setting:
{.}/compile:buildInfoPackage from {.}/compile:packageBin::packageOptions
看起来sbt试图引用插件使用它的范围之外的设置。为什么会这样,我该如何解决?
答案 0 :(得分:1)
这里的问题不是多模块性质,因为它在单模块项目中也是可重现的。
但不是
override lazy val buildSettings = ...
您需要使用projectSettings
来使buildInfoPackage
任务可用。