scalasbtdeprecation-warningmainclass

sbt deprecation warning <<= replaced with := results in no main class found


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

Solution

  • 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