sbt10, webplugin, jetty, run-in-place: once more...

it turns out that the sbt/web-plugin configuration i described in my last post is not quite cutting it. what we observed is that while changes to the contents of the webapp subtree were indeed effective immediately1 sbt commands like prepare-webapp and jetty-reload would sometimes work and sometimes just ignore us.

so, back to digging around in the web-plugin sources and this is what we are now using:

[scala] temporaryWarPath <<= (sourceDirectory in Runtime) / "webapp", // watch temporaryWarPath / WEB-INF / classes jettyScanDirs <<= (temporaryWarPath) { (target) => Seq(target / "WEB-INF" / "classes") }, [/scala]

this sbt configuration tells jetty to run out of the src/main/webapp directory — any changes you do in there will become effective immediately and prepare-webapp and jetty-reload are working as expected. the drawback is that your generated classes and lib files get copied to src/main/webapp/WEB-INF :-( i know, sucks, but still better than having to restart your webapp everytime you change a {html,css,js} file. if you are using git you might want to add

src/main/webapp/WEB-INF/lib/*
src/main/webapp/WEB-INF/classes/*

to your top-level .gitignore file.


  1. on browser reload, that is.