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.2.0"

The plugin provides a new task called generateRebel that by default depends on the processResources phase. For more fine-tuned control it can be changed to only run before certain tasks, for example only before building a war artifact:


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 scripts.

 plugins {
   id 'org.zeroturnaround.gradle.jrebel' version '1.2.0' apply false
 allprojects {
   apply plugin: 'org.zeroturnaround.gradle.jrebel'
 plugins {
   id("org.zeroturnaround.gradle.jrebel") version "1.2.0" apply false
 allprojects {
   apply (plugin = "org.zeroturnaround.gradle.jrebel")

Advanced configuration

For more help configuring Gradle, please check out: