Fork me on GitHub

The Apache Isis JRebel plugin for JRebel allows you to alter the domain classes in your development environment and have the running app pick up those changes (avoiding a restart).

JRebel monitors the compiled bytecode of the domain object classes, and reloads whenever these are changed. The Isis plugin then recreates the Isis and JDO metamodels automatically.

This page describes how to use the JRebel with:

The Isis JRebel plugin itself is free for use, and is hosted on github. However, JRebel itself is commercial software. There is though a community version that is free for open source use. Please check terms and conditions before using.

Note that Isis must be run in prototype mode to automatically pick up changes.

Prerequisites

There are two prerequisites:

DOM project configuration

The dom module requires a rebel.xml file in order to tell JRebel which classes to monitor. This file resides in src/main/resources, and is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
    <classpath>
        <dir name="${project.root}/dom/${target.dir}/classes">
        </dir>
    </classpath>
</application>

Note the use of the ${project.root} and ${target.dir} properties; values are supplied when the application is launched (as explained below).

Prior to 1.5.0, the rebel.xml file simply had hard-coded values within it.

Using Maven with JRebel (v1.5.0 onwards)

This screencast shows how to use Maven in conjunction with JRebel:

The command used to run the webapp is:

mvn -P jrebel antrun:run \
    -Djrebel.jar="C:/Users/Dan/.IdeaIC13/config/plugins/jr-ide-idea/lib/jrebel/jrebel.jar" \
    -Disis_jrebel_plugin.jar="C:/github/danhaywood/isis-jrebel-plugin/target/danhaywood-isis-jrebel-plugin-1.0.0-SNAPSHOT.jar"

Change the values of rebel.jar and isis_jrebel_plugin.jar as necessary:

Using Eclipse with JRebel

Remember to install the JRebel plugin for Eclipse from the Eclipse Marketplace (Help > Eclipse Marketplace), and set up a license.

This screencast shows how to use Eclipse in conjunction with JRebel:

The archetypes already include a .launch file for JRebel. You will have to adjust some of the property values:

Using IntelliJ with JRebel

Remember to installed the JRebel plugin for IntelliJ (File > Settings > Plugins), and set up a license.

This screencast shows how to use IntelliJ in conjunction with JRebel:

This screencast follows on from the one that explains how to setup IntelliJ as your IDE.

The screenshot below show the Run/Debug configuration updated with appropriate VM options:

where the VM options, in full, are:

If you want to copy-n-paste those VM options, they are:

-Drebel.log=false
-Drebel.check_class_hash=true
-Drebel.packages_exclude=org.apache.isis
-Dproject.root=C:\APACHE\isis-git-rw\example\application\simple_wicket_restful_jdo
-Dtarget.dir=target
-Drebel.plugins=C:/github/danhaywood/isis-jrebel-plugin/target/danhaywood-isis-jrebel-plugin-1.0.0-SNAPSHOT.jar
-Disis-jrebel-plugin.packagePrefix=dom.simple,org.apache.isis.objectstore.jdo.applib
-Disis-jrebel-plugin.loggingLevel=warn
-XX:MaxPermSize=128m

You'll need to adjust the value of some of these: