SBT dependsOn usage - migration from 0.12 to 0.13
Asked Answered
G

1

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?

Gaur answered 20/6, 2017 at 15:25 Comment(2)
"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?Porscheporsena
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.Gaur
G
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.

Gaur answered 21/6, 2017 at 7:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.