JRebel Gradle plugin

When should you use this plugin?

To enable JRebel for a project, you need to add the rebel.xml configuration file to it. The rebel.xml configuration file has to be added to the deployed WAR or JAR archive. This will let the JRebel agent know which workspace paths to monitor for class and resource updates.

The purpose of the JRebel Gradle plugin is to generate the rebel.xml file for your project during the Gradle build.

When using a JRebel IDE plugin, it is recommended to generate rebel.xml files using the IDE plugin. If you do so, there is no need to use the JRebel Gradle plugin. Generating rebel.xml using the JRebel Gradle plugin is intended for situations when generation using the IDE plugin is not available or produces inaccurate results.

Refer to application configuration using rebel.xml for details on rebel.xml file format.

Enable the JRebel Gradle plugin

When using Gradle 2.1 or newer, add the following snippet to the top of your build.gradle script:

plugins {
  id "org.zeroturnaround.gradle.jrebel" version "1.1.8"

This will provide your Gradle build with a new task called generateRebel. Add this task to your main build flow, executing it before building the archive with the jar or war tasks.

When your project uses the Gradle Java plugin:


And when your project uses the Gradle War plugin:


In most cases, this is all you need to do. The plugin should be able to read the locations of your classes and resources from Gradle’s project model and put them into your rebel.xml.

IDE configuration

Please note that the Gradle Eclipse plugin does not seem to generate project files that would configure Eclipse to auto-compile your classes into the same folder where Gradle is compiling them. JRebel class reloading relies on your IDE to automatically re-compile your classes, so that JRebel can pick them up.

The compilation output directory of your IDE and the monitored classes directory have to match in order for the class reloading to work. Therefore, make sure that your IDE is compiling classes into the same directory where your Gradle project model and the rebel.xml file are expecting them (build/classes/main by default, as opposed to bin which is the default for Eclipse).

JRebel Gradle plugin configuration for use with multi-module projects

To configure the JRebel Gradle plugin’s automatic rebel.xml generation for all modules in a multi-module project, use the following script.

buildscript {
  repositories {
  dependencies {
    classpath "org.zeroturnaround:gradle-jrebel-plugin:1.1.8"
allprojects { project ->
  plugins.withId('java') {
    project.apply plugin: 'org.zeroturnaround.gradle.jrebel'
    def jarTask = project.tasks.findByName('jar')
    if (jarTask) {
    def warTask = project.tasks.findByName('war')
    if (warTask) {

Advanced configuration

For more help configuring Gradle, please check out: