Home

Awesome

sbt-revolver is a plugin for SBT enabling a super-fast development turnaround for your Scala applications.

It sports the following features:

Even though sbt-revolver works great with spray on spray-can there is nothing spray-specific to it. It can be used with any Scala application as long as there is some object with a main method.

Installation

sbt-revolver requires SBT 1.x or greater. Add the following dependency to your project/plugins.sbt:

addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0")

sbt-revolver is an auto plugin, so you don't need any additional configuration in your build.sbt nor in Build.scala to make it work. In multi-module builds it will be enabled for each module. To disable sbt-revolver for some submodules use Project(...).disablePlugins(RevolverPlugin) in your build file.

For older versions of sbt see version 0.9.1.

Usage

sbt-revolver defines three new commands (SBT tasks) in its own re configuration:

Triggered Restart

You can use ~reStart to go into "triggered restart" mode. Your application starts up and SBT watches for changes in your source (or resource) files. If a change is detected SBT recompiles the required classes and sbt-revolver automatically restarts your application. When you press <ENTER> SBT leaves "triggered restart" and returns to the normal prompt keeping your application running.

To customize which files should be watched for triggered restart see the sbt documentation about Triggered Execution.

Configuration

The following SBT settings defined by sbt-revolver are of potential interest:

Examples:

To configure a 2 GB memory limit for your app when started with reStart:

javaOptions in reStart += "-Xmx2g"

To set a special main class for your app when started with reStart:

mainClass in reStart := Some("com.example.Main")

To set fixed start arguments (than you can still append to with the reStart task):

reStartArgs := Seq("-x")

To enable debugging with the specified options:

Revolver.enableDebugging(port = 5050, suspend = true)

To change set of colors used to tag output from multiple processes:

reColors := Seq("blue", "green", "magenta")

There are predefined color schemes to use with reColors: Revolver.noColors, Revolver.basicColors, Revolver.basicColorsAndUnderlined.

To add environment variables when running the application:

envVars in reStart := Map("USER_TOKEN" -> "2359298356239")

Hot Reloading

Note: JRebel support in sbt-revolver is not actively supported any more.

If you have JRebel installed you can let sbt-revolver know where to find the jrebel.jar. You can do this either via the Revolver.jRebelJar setting directly in your SBT config or via a shell environment variable with the name JREBEL_PATH (which is the recommended way, since it doesn't pollute your SBT config with system-specific settings). For example, on OSX you would add the following line to your shell startup script:

export JREBEL_PATH=/Applications/ZeroTurnaround/JRebel/jrebel.jar

With JRebel sbt-revolver supports hot reloading:

License

sbt-revolver is licensed under APL 2.0.

Patch Policy

Feedback and contributions to the project, no matter what kind, are always very welcome. However, patches can only be accepted from their original author. Along with any patches, please state that the patch is your original work and that you license the work to the sbt-revolver project under the project’s open source license.