22

In SBT .7, you could do

~jetty-run

in order to get your files to auto compile and reload the web app whenever something changes. In SBT .11, You can do

~container:start

which also re-compiles files, but does not seem to reload the web app, everytime something changes. Rather, I have to do a

container:stop
container:start

to see the changes. The problem with this is that it takes ~30s for the it all to restart. Is there a better way of doing it? Digging through google and SBT has not found me any answers

EDIT: doing a

container:start
container:reload

each time something changes, seems to work well. However, is it possible to make it happen automatically in that sequence? Something like:

~(container:start, container:reload)

which doesn't work, but i wish it did

Jared Casper
  • 170
  • 8
Li Haoyi
  • 15,330
  • 17
  • 80
  • 137
  • See if this question is similar http://stackoverflow.com/questions/8469503/sbt-0-11-2-how-to-combine-copy-resources-with-aux-compile – fmpwizard Dec 17 '11 at 18:04

3 Answers3

44

So it turns out the answer is that ~ can take a command list, as was mentioned in the link fmpwizard left. Hence you can do

~;container:start; container:reload /

does the correct thing: each time I save the files, it recompiles the necessary files and reloads the web app!

EDIT: should be container:reload, as mentioned. Thanks!

Li Haoyi
  • 15,330
  • 17
  • 80
  • 137
  • +1, I believe you meant, "~;container:start; container:reload /", I get an error with "container reload". The former does the trick nicely in a Scala/SBT/Spray project... – virtualeyes Dec 18 '11 at 21:32
  • Is there any way to do this that keeps the user logged in? It's a pain to have to log in again every time I change a file. – Fiona Hopkins Apr 24 '12 at 00:29
  • @phopkins yes you need to add extended sessions to your application : https://www.assembla.com/spaces/liftweb/wiki/Extended_Sessions – Roch Jul 18 '13 at 21:38
1

~container:start is not needed ,
you can use first container:start without ~ , and then ~container:reload , so container:start isn't relaunched after every code change .. i think

-1

Did you try something like :

container:start
~compile
David
  • 2,399
  • 20
  • 17