Add the following snippet to your parent pom.xml
. The rebel.xml configuration file will be generated for
each individual sub-module of your maven project.
<plugin> <groupId>org.zeroturnaround</groupId> <artifactId>jrebel-maven-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <id>generate-rebel-xml</id> <phase>process-resources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>
This will generate JRebel configuration file rebel.xml
automatically on every build. If you want to
generate the rebel.xml
manually run mvn jrebel:generate -Drebel.xml.dir=OUTPUT_DIRECTORY
(by default OUTPUT_DIRECTORY
is target/classes
). Adding
-Drebel.generate.show=true
will print out generated rebel.xml
at info level, so you can
immediately see what was generated.
By default, the generated rebel.xml
contains absolute paths to your workspace. However if you want to deploy
the artifacts for your team to use, you will need to make sure that the paths are relative using a configurable custom
property.
Assuming that you have the following project structure in directory c:\projects\
:
my-maven-project1 my-jar1 my-war1
You should add the following configuration to the plugin:
<configuration> <!-- root is 2 directories up from the jar/war modules --> <relativePath>../../</relativePath> <!-- use a custom property for specifying root directory (note the double $) set the property in JRebel configuration or as -Dmyproject.root=c:/projects/ --> <rootPath>$${myproject.root}</rootPath> </configuration>
Now you will have c:/projects/my-maven-project1/my-jar1/target/classes
as ${myproject.root}/my-maven-project1/my-jar1/target/classes
in the rebel.xml
. You can set this property as a Java System property (-Dmyproject.root=c:/projects/
)
or in the JRebel Agent Configuration: