Using JRebel with IntelliJ IDEA on OS X
Join the DZone community and get the full member experience.Join For Free
yesterday afternoon, i figured out how to use jrebel with intellij idea. i wrote up some appfuse documentation for it at using jrebel with intellij idea and figured i'd repost it here for those developers using idea 9 and maven.
- download and install intellij idea 9 ultimate edition (in /applications on os x).
and install jrebel.
- java -jar jrebel-setup.jar
- install the jrebel plugin for idea . shortcut: file > settings > search for plugins and find jrebel.
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.
setenv m2_home /opt/tools/maven2
more info on this setting is available on stack overflow .
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).
- if you're using the maven jetty plugin , change your pom.xml so jetty doesn't reload the app when classes are compiled. specifically, change scanintervalseconds to 0. if you're not using this plugin, you should definitely check it out for java webapp development.
- use the jrebel icons to start jetty:run in your ide.
command line integration:
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 example:
export java_opts="-xmx512m -xx:permsize=256m -xx:maxpermsize=512m -djava.awt.headless=true"
export maven_opts="$java_opts -noverify -javaagent:$jrebel_home/jrebel.jar"
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.
jrebel: reloading class 'org.appfuse.webapp.action.useraction'.
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.
i'm assuming the steps to make things work on windows and linux are similar. please let me know if you have any issues with these instructions.
Opinions expressed by DZone contributors are their own.