How to configure sbt to restart a long-term server process when changing code?

Using the ~run command, sbt will restart the executable for me whenever the source file changes. This is good, but if the goal is a long server process, sbt pauses until the child completes, so the source changes are not affected.

I would like to have an sbt monitor and recompile my sources, even when the target code is running, and restart the process in a successful build. Has anyone tried to install this?

+6
sbt
source share
3 answers

(Sorry for the posthumous answer)

https://github.com/spray/sbt-revolver was created to solve this problem.

+8
source share

This is not possible thanks to the built-in "~" function. The problem is that the task of "~" conversion must be completed. If this is a server application listening on some ports, you first stop it.

Perhaps you could create your own task or modify the run task to kill / close the running application (for example, by sending a magic output line to the listening port?). See This for more information:

http://code.google.com/p/simple-build-tool/wiki/CustomActions

+5
source share

JRebel can help you with reloading a dynamic class if that is what you need. Free Scala license here . Information on use on the SBT website .

+1
source share

All Articles