Skip to content

"Unable to auto detect project license" on aggregate project #153

@dragos

Description

@dragos

I'm trying to upgrade to Sbt 1.0 and from sbt-header version 1.7.0 to 5.0.0 as the same time. I can't run headerCheck anymore because it crashes with:

sbt:root> headerCreate
[error] java.lang.RuntimeException: Unable to auto detect project license
[error]         at scala.sys.package$.error(package.scala:27)
[error]         at de.heikoseeberger.sbtheader.HeaderPlugin$.$anonfun$toBeScopedSettings$4(HeaderPlugin.scala:111)
[error]         at scala.Option.getOrElse(Option.scala:121)
[error]         at de.heikoseeberger.sbtheader.HeaderPlugin$.$anonfun$toBeScopedSettings$3(HeaderPlugin.scala:111)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:66)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:271)

It would be good to tell me what project it is, but my guess is that this is the root aggregate project (as I'm setting project-specific settings for each subproject). I don't have any sources in root, so what's the proper solution to get past this? I don't want to define any header license for root, as it makes no sense.

EDIT: Reproducible:

lazy val leaf = (project in file("leaf")).
  settings(
    headerLicense := Some(HeaderLicense.Custom(
      """|Copyright © 2016-2017 You have the right to be happy
         |""".stripMargin
    )),
    organization := "com.example",
    scalaVersion := "2.12.4",
    version      := "0.1.0-SNAPSHOT",
    name := "test-sbt-header",
  )

headerLicense in ThisBuild := None

lazy val deps = (project in file("deps"))
  .settings(
    headerLicense := Some(HeaderLicense.Custom(
      """|Copyright © 2016-2017 You have the right to be happy
         |""".stripMargin
    )))

lazy val root = (project in file("."))
  .settings(headerLicense := None)
  .aggregate(leaf, deps)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions