1

I have the following project definition (simplified):

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)
}

and the BuildTag plugin (also simplified to the issue at hand):

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))
    }
  )
}

when I load the project, I get an error like:

Reference to undefined setting: 

  {.}/compile:buildInfoPackage from {.}/compile:packageBin::packageOptions

It looks like sbt is trying to reference the setting outside of the scope where the plugin is using it. Why might that be and how can I fix it?

Justin Kaeser
  • 5,868
  • 27
  • 46

1 Answers1

1

The problem here was not the multi-module nature, because it is reproducible also in a single-module project.

However instead of

override lazy val buildSettings = ...

you need to use projectSettings to make the buildInfoPackage task usable.

Justin Kaeser
  • 5,868
  • 27
  • 46