July 22, 2011
filed in the early afternoon by dr_who in: hacking

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


to your top-level .gitignore file.

  1. on browser reload, that is. 

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.

1 comment »

  1. […] described below turns out to have its flaws and is not really recommended — have a look at the recently posted update for a better […]

    pingback by xyzzy xyzzy… » sbt10, webplugin: running jetty from source tree — July 22, 2011 @ 14:58

RSS feed for comments on this post. TrackBack URI

Leave a comment