Liferay users will be happy to know that it is possible to make a Hook so that you can reload JSP changes without redeploying your application. For those of you new to Liferay and/or JRebel, hooks are small programs that you deploy to overwrite some small part of Liferay’s default functionality. By using Liferay JSP hooks, you can keep your code separated from the default Liferay code; and since Liferay is open source, you can download it, make your code changes then deploy it.
By adding JRebel to this equation, you can enjoy a super-fast feedback cycle by eliminating the redeployment process altogether. This is a small “JRebel with Liferay” screencast designed to show you how to do just that.
The following versions of software were used in this demo:
- Eclipse-jee-indigo-SR1-win32-x86_64
- Liferay IDE 1.4.0 (From eclipse marketplace)
- JRebel 4.5.3 (201112070111) (From eclipse marketplace)
- Liferay CE 6.0.6 SDK and bundled tomcat-6.0.29
Before we begin, we should make the following assumptions:
- You have your development environment ready.
- You have Eclipse installed and it has plugins for both JRebel (or JRebel for Eclipse) as well as Liferay IDE.
- You have made a Liferay server runnable in Eclipse and have set up a Liferay SDK project.
In this tutorial we will be:
- Starting Liferay server with JRebel enabled.
- Making a small JSP hook, adding and modifying rebel.xml.
- Deploying the hook on server.
- Seeing that when we change the JSP, the page is changed on refresh.
Source code of the hook: JRebelTest-hook
Questions and Answers:
Q: I made a change to a JSP in my hook but the entire hook is immediately redeployed on save. Is JRebel supposed to do that?
A: When a change is made to JSP, only the changed file must be reloaded. The probable cause is that when you change your hook Eclipse automatically publishes the hook to Liferay. It can be disabled under server “Overview” (Eclipse Servers tab -> double click on a Liferay server):

Q: I have JRebel Eclipse plugin installed, but there are no JRebel check boxes in my IDE, what might be wrong?
A: Currently we have the JRebel check boxes in Liferay 6 CE versions IDE, but not in Liferay EE-s Liferay Developer Studio (they will be in JRebel nightly version build soon)
If you don’t have JRebel check boxes you can add JRebel arguments under server console:
We hope this post about Liferay JSP hooks was useful, and please leave your feedback below in the comments section!
-
Bijan Vakili
-
Qsd Qsd
-
http://twitter.com/antonarhipov Anton Arhipov



