Joonas Javanainen

SBT and JRebel

I was at first sceptical about JRebel, but after using it for a while, I must say that it's awesome!

It's compatible with SBT, so you can get a good boost to your productivity when you combine JRebel with the incremental compilation of Scala code in SBT.

However, when using JRebel, you don't want Jetty to redeploy the webapp automatically. You could just disable Jetty manually but then people who don't use JRebel would have to reload manually.

Here's how to disable Jetty redeploying in SBT only if JRebel is active:

class YourProject(info: ProjectInfo) extends DefaultWebProject(info) {
  lazy val jrebelInUse = List("jrebel.lic", "javarebel.lic").exists(this.getClass.getClassLoader.getResource(_) != null)

  override def scanDirectories = if (jrebelInUse) Nil else super.scanDirectories
}

Update: Consider using sbt-jrebel-plugin instead because it can also generate rebel.xml files for you!