2

When using sbt 0.13.13. I could observe that when using := no main class is found (but no deprecation warning is shown), and for <<= I get the warning, but the main class is found. What is wrong here?

run in Compile := Defaults.runTask(fullClasspath in Compile, mainClass in(Compile, run), runner in(Compile, run))
run in Compile <<= Defaults.runTask(fullClasspath in Compile, mainClass in(Compile, run), runner in(Compile, run))
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292

1 Answers1

4

run is an InputTask[Unit] and the type of runTask is Def.Initialize[InputTask[Unit]] and the right side of := needs to be a Unit.

What you did compiles because any value can be discarded in favor of a return value of type Unit, but it doesn't have the same semantics as before.

For input tasks, you need to "evaluate" the task:

run in Compile := Defaults.runTask(
  fullClasspath in Compile,
  mainClass.in(Compile, run),
  runner.in(Compile, run)).evaluated
Justin Kaeser
  • 5,868
  • 27
  • 46
  • 1
    "any value fits the Unit type", just to be pedantic, it's more that any value can be discarded and the unit value () can be inserted. – Dale Wijnand May 12 '17 at 08:51