A sample maven plugin configuration with comments follows:
<plugin> <groupId>org.zeroturnaround</groupId> <artifactId>jrebel-maven-plugin</artifactId> <version>1.1.1</version> <configuration> <!-- If your project uses custom packaging that is not recognized set this to jar or war. --> <packaging>war</packaging> <classpath> <fallback>default</fallback> <resources> <resource> <!-- A relative path. --> <directory>target/special-classes </directory> <!-- You may use includes and excludes as with any other resource. --> <includes> <include>com/yourapp/include/package1/** </include> <include>com/yourapp/include/package2/** </include> </includes> <excludes> <exclude>com/yourapp/exclude/package1/** </exclude> <exclude>com/yourapp/exclude/package2/** </exclude> </excludes> </resource> <resource> <!-- Empty resource element marks default configuration. By default it is placed first in generated configuration. --> </resource> <resource> <!-- An absoulte path is used here. --> <jar>c:\projects\myProject\3rdpartyLibs\myLibrary.jar </jar> </resource> <resource> <jarset>app/3rd-party-lib</jarset> <excludes> <exclude>apache*.jar</exclude> </excludes> </resource> <resource> <dirset>c:\projects\project1Root\ </dirset> <excludes> <exclude>**\build\classes</exclude> </excludes> </resource> </resources> </classpath> <war> <path>c:\projects\myProject\dist\myProject.war </path> </war> <web> <resources> <resource> <target>gfx/</target> <directory>c:\projects\myProject\static\gfx </directory> </resource> <resource> <!-- Empty resource element marks default configuration. By default it is placed first in generated configuration. --> </resource> </resources> </web> <!-- addResourcesDirToRebelXml - default is false Required if the resource directories are to be added to rebel.xml --> <addResourcesDirToRebelXml>true</addResourcesDirToRebelXml> <!-- alwaysGenerate - default is false If 'false' - rebel.xml is generated if timestamps of pom.xml and the current rebel.xml file are not equal. If 'true' - rebel.xml will always be generated --> <alwaysGenerate>true</alwaysGenerate> </configuration> </plugin>
Also, maven has a notion of build profiles defined in your application's POM that you can leverage.
<profiles> <profile> <id>jrebel</id> <activation> <property> <name>env</name> <value>jrebel</value> </property> </activation> <build> <plugins> <plugin> <groupId>org.zeroturnaround</groupId> <artifactId>jrebel-maven-plugin</artifactId> <executions> <execution> <id>generate-rebel-xml</id> <phase>process-resources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>
Executing the example above with mvn -Denv=jrebel clean install
command will trigger JRebel plugin to generate rebel.xml.