Develop with JRebel

This page explains how to use JRebel, a third-party development tool, with Bloomreach Content. Bloomreach maintains this documentation on a best-effort basis and does not guarantee that it reflects the latest JRebel release. For current installation, configuration, and usage details, refer to the official JRebel documentation.

Building and redeploying your web application after every code change can slow down development. JRebel enables you to see code changes instantly without full redeployment, reducing development cycle time.

Installing JRebel

To get started, download a trial version of JRebel from the official site. After downloading and unpacking JRebel, follow the official JRebel documentation to configure the JRebel Agent.

To enable the JRebel Agent when running your project locally with Cargo, set the javaagent property in your Maven ~/.m2/settings.xml or in your project configuration. Example profile:

<profile> <id>jrebel</id> <activation> <property> <name>jrebel</name> </property> </activation> <properties> <javaagent>-agentpath:/home/user/jrebel/lib/libjrebel64.dylib</javaagent> </properties> </profile>

Generating the JRebel Descriptors

The Bloomreach Content project POM includes a Maven profile for generating and enabling JRebel support. Activate this profile by specifying the jrebel property when building your project:

mvn verify -Djrebel 

This command generates JRebel descriptors for both the CMS and site modules. JRebel will monitor class files and resources in both modules for changes. You can review the generated configuration in cms/target/classes/rebel.xml and site/target/classes/rebel.xml.

Note:
When creating a project distribution, ensure you perform a clean build without the JRebel profile. If the JRebel profile is active, rebel.xml files will be included in the WAR files. To explicitly deactivate the JRebel profile, use:

mvn ... -P !jrebel

Running with JRebel

To run your project with Cargo and JRebel enabled, use the following command:

mvn -P cargo.run -Djrebel

Alternatively, you can set the javaagent property directly from the command line without modifying your Maven settings or project files:

mvn -Pcargo.run -Djavaagent=-agentpath:/home/user/jrebel/lib/libjrebel64.dylib

IDE Plugin

You can use the JRebel plugin for your preferred IDE instead of a standalone JRebel installation. The IDE plugin allows you to work with JRebel directly from your development environment, eliminating the need for command line tools.

Debugging in Eclipse While Running JRebel

If you use Eclipse and want to debug your project while running JRebel, install the JRebel Eclipse Plugin. Without this plugin, using JRebel in debug mode can cause issues: the debugger may not recognize new methods, making breakpoints unreliable and stepping behavior inconsistent. The Eclipse plugin resolves these issues and ensures stable debugging during live code updates.

Disable JRebel CXF Plugin

After recompiling code, you may find that HST REST services stop working when JRebel picks up changes. To resolve this, disable the JRebel 'CXF' plugin:

  1. Install the JRebel plugin for your IDE.
  2. Open the 'Plugins' section in the JRebel plugin configuration.
  3. Disable the 'CXF Plugin'.

You can also disable any other plugins you do not require.

If your IDE does not support a JRebel plugin, edit the JRebel configuration file directly:

~/.jrebel/jrebel.properties

Add the following line to disable the CXF plugin:

rebel.cxf_plugin=false

Reload JAXRS Endpoint Resources and (JAXB) Representations Without Restart

JAXRS resource bean annotations and JAXB representations do not refresh automatically after changes, even with JRebel enabled. This occurs because CXF loads annotations only once. To pick up changes, you typically need to restart the application (a rebuild is not required, as JRebel updates the classes).

As an alternative, you can trigger an HST container reload, which also reloads the CXF controller. To do this, modify and save the hst-config.properties file. After the reload, changes to your JAXRS resources and JAXB representations will be recognized.

To enable automatic HST container reloads after changes to hst-config.properties, configure the hst-config-refresh-delay parameter in web.xml or context.xml:

<context-param> <param-name>hst-config-refresh-delay</param-name> <param-value>3000</param-value> </context-param>
Share Feedback
Page: /build/development-tools/develop-with-jrebel
Section: Build
Category *