To configure Rebel XML files for JRebel, you must begin by adding the appropriate agent path to your JVM command line. These agent paths vary depending on your operating system and can be found in our official documentation, which includes visual examples for clarity.
The purpose of JRebel is to map your project workspace directly to a running application. It monitors any changes made to your classes and resources and dynamically reflects those changes into your live application. To do this effectively, JRebel requires knowledge of where your classes and resources are located. This is facilitated through the use of a configuration file called rebel.xml.
Standalone Rebel.xml Plugin
The rebel.xml file maps the deployed version of your project back to your workspace. This mapping is essential when deploying your application as a WAR or EAR package, and each module in your project—whether it's a web module or an EJB module—must contain its own rebel.xml configuration file. Detailed instructions and examples for WAR, JAR, and EAR configurations are also provided in the documentation.
When using a JRebel IDE plugin, it is recommended to generate the rebel.xml file directly through the IDE. However, if you are not using an IDE or require automation, JRebel offers dedicated Maven and Gradle plugins for generating these files.
JRebel Maven Plugin
Designed to generate the rebel.xml file during your Maven build. This is particularly helpful in multi-module projects, where configuring each module manually would be inefficient. You can integrate the plugin by adding a specific snippet to your parent pom.xml file. This ensures that the rebel.xml file is generated for each sub-module automatically with every build. If you only want to generate the rebel.xml file without a full build, you can use the following command: mvn jrebel:generate
JRebel Gradle Plugin
Used during the Gradle build process to create the rebel.xml file. For projects using Gradle 2.1 or newer, you can enable the plugin by adding a configuration snippet at the top of your build.gradle script. This plugin introduces a new task called generateRebel, which, by default, is linked to the processResources phase. If you prefer more control, you can modify this behavior so that generateRebel runs only before specific tasks—for instance, only before building a WAR artifact—using: war.dependsOn generateRebel
In most cases, no additional configuration is needed. The plugin will automatically determine the location of your classes and resources from Gradle’s project model and include them in the generated rebel.xml.