I have a simple Spring Boot application and I noticed that it reloaded changes even without the rebel.xml? What is the purpose of that file?
-
AFAIK rebel.xml has 2 purposes: as a trigger (only watch for changes in artifacts that contain that file) and as a configuration (which (re)sources to watch). If Spring Boot picks up changes even without rebel.xml I'd guess it's not JRebel that does the reloading and thus you'd as well run without the JRebel agent. Also have a look at the [rebel.xml documentation](https://manuals.zeroturnaround.com/jrebel/standalone/config.html). – Thomas Feb 10 '17 at 11:44
2 Answers
JRebel uses the rebel.xml file in order to remap your classpath resources and servlet resources to your build directory so that when you make a change in the IDE and build the class, then JRebel will detect the change in that build directory and reload the changed class.
Regardless of the rebel.xml file, JRebel monitors all directories it can find in the classpath. It doesn't monitor jar, war files. So if starting a jar file with JRebel and without a rebel.xml file then it wouldn't have any directories to monitor and wouldn't be able to reload anything.
That's why the rebel.xml file is needed:
- To make JVM load the classes from the build directory
- To add the directories in the rebel.xml to classpath so JRebel would monitor them
However in many cases when running a standalone application inside an IDE, then the IDE doesn't run the jar file, but instead directly runs the classes from the build directory and adds the build directory to the classpath.
In that case the classes being run are already in the build folder so they are reloadable and also the changes happen in a directory that is monitored by JRebel. Such a setup doesn't need the rebel.xml file. The same thing sometimes also happens with an exploded web application started from an IDE.
You can check if that's also the case with your application by running the app in command line.
First run the Spring Boot jar file with JRebel and without a rebel.xml file and you'll see the reloads won't happen. To see the reloads you'd need to generate the rebel.xml file and build it into the jar.
When you however add the build dir to the classpath and run the class, then JRebel should reload the classes without needing the rebel.xml file.
You can read more about the rebel.xml file from here: https://manuals.zeroturnaround.com/jrebel/standalone/config.html

- 161
- 5
There is far more to JRebel than just the rebel.xml file.
Basically, there are 3 different parts:
- rebel.xml: that defines the scope of your IDE resources that are subject to "hot swapping. In other words: this file controls which files can be "hot swapped".
- rebel-remote.xml: might be required to tell that "remote server" that uses the JRebel agent about the "component(s)" which are eligible for "hot swap"
- then of course: the nature of that "remote server" itself; as that could be just a process started locally by your IDE; but also a JVM that runs independently on a different machine.
Long story short: it seems that you started using this tool without learning how to use. Thus the essential answer here is: go, read the manual. For example, starting here.

- 137,827
- 25
- 176
- 248
-
For the main scenario, only rebel.xml is required unless the compiler target folder is not the same where the resources are loaded from. The additional rebel-remote.xml and remote server configuration are required for the specific scenario when the application/server is running remotely. – Anton Arhipov Feb 11 '17 at 13:29