Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JRebel plugin for Simple Build Tool
branch: master

This branch is 9 commits behind Gekkio:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
notes
src/main/scala
.gitignore
LICENSE
README.md
build.sbt

README.md

sbt-jrebel-plugin

Introduction

sbt-jrebel-plugin is a plugin for Simple Build Tool that generates configuration files (rebel.xml) for JRebel. A rebel.xml is not always required but is recommended because if you don't have one, JRebel cannot understand the layout of your project and might fail to reload changes. You also cannot reload changes from separate projects.

Features

  • Generates rebel.xml, so it's similar to javarebel-maven-plugin in the Maven world
  • Cross-project change reloading

Default behaviour

  • Disables itself if SBT isn't run with JRebel agent enabled
  • Writes rebel.xml as a managed resource which is automatically added to classpath and artifacts

You should always disable sbt-jrebel-plugin when publishing artifacts somewhere else than locally. Otherwise your artifacts will include rebel.xml files

Usage

Make sure you run sbt with JRebel agent enabled

First, add the maven repository and the plugin declaration to project/plugins.sbt or project/plugins/build.sbt (both will work but the former is recommended SBT 0.11+):

resolvers += "Jawsy.fi M2 releases" at "http://oss.jawsy.fi/maven2/releases"

addSbtPlugin("fi.jawsy.sbtplugins" %% "sbt-jrebel-plugin" % "0.9.0")

Then include the plugin settings in your project definition:

seq(jrebelSettings: _*)

If you are using xsbt-web-plugin and want to reload web resources, also add this:

version 0.1.x:

jrebel.webLinks <+= temporaryWarPath

version 0.2.x:

jrebel.webLinks <++= webappResources in Compile

How do I ...?

Disable rebel.xml generation

Project definition: jrebel.enabled := false

or in SBT console: set jrebel.enabled := false

Force rebel.xml generation (regardless of whether you run SBT with JRebel enabled)

Project definition: jrebel.enabled := true

or in SBT console: set jrebel.enabled := true

Cross-project change reloading

Let's say you have two projects, MyLib which is a library project and MyWebApp which is a webapp. These two are completely separate and differently versioned projects. If you have sbt-jrebel-plugin enabled for both projects, you can make changes in MyLib while developing MyWebApp and have them reloaded instantly.

  • Deploy MyLib with sbt publish-local. The package includes a rebel.xml file that contains the absolute paths to your MyLib project directories.
  • Update MyWebApp dependencies with sbt update. MyWebApp now uses the MyLib package that has a rebel.xml.
  • Run MyWebApp and enable continuous webapp compilation (for example I use sbt jetty-run "~ prepare-webapp")
  • In a separate terminal, start continuous compilation for MyLib (for example, sbt ~ compile).
  • Change a class in MyLib
  • Notice that the change is visible in MyWebApp (if the change is reloadable using JRebel). Voilá!

Do not share rebel.xml files because by default they contain absolute paths which are computer-specific!

TODO

Nothing at the moment! Please report any bugs you might find

Something went wrong with that request. Please try again.