tags:

views:

93

answers:

2

Using the ~run command, the simple build tool will re-run an executable target for me whenever a source file changes. This is nice, but if the target is a long-running server process, sbt is suspended until the child terminates, so source changes have no effect.

I'd like to have sbt monitor and recompile my sources even while the target code is running, and restart the process on a successful build. Has anybody tried to set this up?

+3  A: 

This is not possible via the built in "~" functionality. The problem is, that the "~"-prefixed task has to complete. If it is a server application listening on some ports, you have stop it first.

Maybe you could create your own task or modify the run task, to kill/quit the running application (e.g. sending a magic exit-string on the listening port?). See this for more information:

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

michael.kebe
Thanks. I'm going to leave this open a couple of days more, but this will probably get done as a custom action, if at all.
Crosbie Smith
+2  A: 

JRebel could help you with dynamic class reloading if that is what you are after. Free Scala licence avaliable here. Usage information at the SBT site.

oluies
On-the-fly reloading may even be a faster solution in most cases, though perhaps not as reliable. As JRebel is a proprietary license I will purse the custom action route first. Thanks!
Crosbie Smith