I have created an sbt project to learn simple crud operation using akka-http. First I added simple routes to check if it is working or not.
By running sbt run
command, I found that it runs locally without any error.
But when I make some changes to the project (for example: Adding println
statement to the running code) it does not auto compiling.
Every time I have to exit (ctrl+c
) the running sbt. And again run to see the updated code.
So my question is that how to auto compile sbt project while running the project.
Thank you.
As far as I know, it's not handled by default by sbt, but there's a plugin for that: sbt-revolver. It will trigger the restart of your application as soon as there are any changes in the source code of your application.
Just add
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
in your build.sbt
and then start the app with:
sbt ~reStart