Lightning fast portlet development with JRebel
Staff Blogs 22. Juli 2011 Von Neil Griffin Staff
Back in April of this year I had the opportunity to speak at the CON-FESS conference in Vienna, Austria. One of the exhibitors there was zeroturnaround.com and I had the privilege of sitting next to founder Jevgeni Kabanov over dinner one night.
Jevgeni described the benefits of JRebel, a JVM-plugin that makes it possible for Java developers to instantly see any code change made to an app without redeploying. Needless to say, redeploying WARs is part of the very fabric of a Liferay portlet developer's life, so I knew that I had to give this product a try with my next ICEFaces 2 portlet with PortletFaces Bridge.
and to my utter amazement... IT WORKED!!!
Simply put, this product is a MUST HAVE for Liferay portlet developers. I'm hooked! Over the past 6 years of portlet development, this product could have saved me COUNTLESS hours of development time waiting for redeploys.
The JRebel documentation is quite good, but here are some quick instructions for how to get started with JRebel and the Liferay+Tomcat bundle:
- Download JRebel (30 day free trial)
- Install JRebel to it's default location. For example, on the Mac: /Applications/ZeroTurnaround/JRebel
- Set the REBEL_HOME environment variable. On the Mac, I find it's best to do this inside the $HOME/.MacOSX/environment.plist file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>REBEL_HOME</key> <string>/Applications/ZeroTurnaround/JRebel</string> </dict> </plist>
- On Mac, add the following to the LIFERAY_HOME/tomcat/bin/setenv.sh script:
- On Windows, add the following to the LIFERAY_HOME/tomcat/bin/setenv.bat file:
- Create a rebel.xml file that will be deployed in the runtime classpath of the WAR:Note that if you install the JRebel plugin for Eclipse, IntelliJ 8/9, IntelliJ X, or NetBeans) you can right click on the project and have the IDE generate the file. You can also generate the rebel.xml file with a Maven goal.
- Maven: src/main/resources/rebel.xml
- Liferay Plugins SDK: docroot/WEB-INF/src/rebel.xml
- Start Tomcat with the liferay/tomcat/bin/startup.sh script (startup.bat on Windows)
- Deploy the WAR to the Liferay /deploy folder
- Make some Java code changes to your app and click Save in your IDE
- Reload your browser, and voila! Instant changes! No redeploy!