This page describes how to install JRebel and configure IntelliJ IDEA to use it. JRebel is a tool that allows you to compile and reload Java classes without restarting your application. In essence, it makes Java web application development very similar to developing with Rails and Grails (from a save/reload perspective). It gives you zero turnaround, which is something all web frameworks should support.
- Download and install IntelliJ IDEA 9 Ultimate Edition (in /Applications on OS X).
- Download and install JRebel.
- java -jar jrebel-setup.jar
- Install the JRebel Plugin for IDEA. Shortcut: File > Settings > Search for plugins and find JRebel.
- On OS X, Modify /etc/launchd.conf and add the following so M2_HOME is available to GUI apps. You'll need to reboot after making this change. available on Stack Overflow. More info on this setting is
- Modify your project's pom.xml to include the JRebel Maven plugin (for generating the configuration of which directories and files to watch for changes).
- Change your pom.xml so Jetty doesn't reload the app when classes are compiled. Specifically, change
- Use the JRebel icons to start jetty:run in your IDE.
- (Optional) Set a JREBEL_HOME environment variable that points to your JRebel install (/Applications/ZeroTurnaround/JRebel on OS X) and set your MAVEN_OPTS to use JRebel's settings (for using JRebel running it from the command line). For example:
After making these changes, you should able to compile classes in IDEA and refresh your browser. Log messages like the following should show up in your console.
To simplify things further, you can map Command+S to compile (instead of Shift+F9). Just look for Keymaps in Settings, rename the default one and search for Compile to remap.