5

I have a command like this in build.sbt

run <<= (run in Compile) dependsOn npmBuildTask

According to documentation <<= is deprecated so I want to use := this one. I tried with;

run in Compile := ((run in Compile).dependsOn(npmBuildTask).value)
run in Compile := (run in Compile).dependsOn(npmBuildTask).value
run in Compile := run.dependsOn(npmBuildTask).value

But whole of them are not working for me. Could you please help me?

sbb
  • 529
  • 3
  • 25
  • "not working for me" — do you get an error message? if so, what is it? or do you get incorrect behavior? if so, what is it? – Seth Tisue Jun 20 '17 at 17:13
  • I didn't get any error but application couldn't start. I couldn't see the main page of application. It's just hanging like an endless loop. – sbb Jun 20 '17 at 19:23

1 Answers1

11

Finally I found the solution.

compile := ((compile in Compile) dependsOn npmBuildTask).value

This is working for me. The problem was in the following code:

run := ((run in Compile) dependsOn npmBuildTask).value

compile and run are different. compile has a return type as sbt.TaskKey[sbt.inc.Analysis] and run has a return type as sbt.InputKey[scala.Unit]. Because of this you should use this command:

run := ((run in Compile) dependsOn npmBuildTask).evaluated

Now everything is working fine.

sbb
  • 529
  • 3
  • 25