Reputation: 327
Good afternoon.
I'm working on a migration from WebSphere to Liferay 6.2 CE.
So far I am able to Export the main project to a WAR file, and Import it in Liferay.
The real problem comes on a development environment...
When changes are made to the project, the deployment process is time consuming. It is necessary to exclude the previous portlet, and install the new one with the changes compiled.
Is there an easier way to deploy the project, directly has a Liferay Portlet? Something like, click a button or run a command, and have it deployed immediately to Liferay's Server.
Best regards.
Upvotes: 1
Views: 757
Reputation: 3824
Liferay 6.2 portlet development supports Ant, Ivy, and Maven build automation. Our developers typically use the Ant build scripts that come standard with Liferay 6.2, and we use Jenkins to automate our deployments to our various test and production servers.
However, even with the aforementioned tools, builds in 6.2 can be tedious and very time consuming. This issue is mostly eliminated in DXP with the introduction of OSGi modules but these OSGi modules are not supported in 6.2.
While Liferay does not provide a solution for this out-of-the-box there is one tool above all else that has drastically decreased our build and deployment times in 6.2
JRebel is a fabulous product for Java EE development and has been especially helpful and supported on the Liferay platform. Essentially JRebel is a tool that allows you to save changes to your code and see those changes instantly without running any Ant targets or moving any war files around.
JRebel is not a free product (it costs $500 a year per license) but you can get a free copy (with 100% of the functionality) if you are using for non-commercial projects. To get a license simply search for "My JRebel" and register an account.
JRebel integrates very easily with Liferay, and there is some documentation on the Liferay Blogs regarding configuration. However the last time I checked the blog posts outline an older way of configuration that is no longer supported (or at least no preferred). Therefore I will briefly go over the steps needed to configure JRebel with Liferay.
Follow these steps after you have obtained either a free license through My JRebel or purchased a license key if this is a commercial project. If you are onboarding this tool at your company you will definitely want to use their license server.
There are a few indications that your configuration is working. Firstly, in your projects source folder you should see a rebel.xml configuration file.
If you see the file there it's time to start the server. Immediately after starting the server you will some new lines written at the top of the catalina log file.
Additionally in your Tomcat's temp folder you should see a new JRebel directory.
Once the portal loads make a change to one of your Java files. In the Catalina console you should see a newly printed line with the fully qualified name of the class you just modified. Check to see if your change has taken effect!
If you have issues at any part in this process there are a few things you might want to look out for. If you are receiving any permgen errors you might want to modify the JVM flags related to memory in your server configuration panel. Additionally in the same location you may need to toggle the publish automatically settings. Additionally I have always had issues with JRebel not working for made to method signatures in the ORM files generated by service builder. If I am adding a new method to those classes JRebel doesn't pick it up. If I am adding or modifying the type of a parameter in one of the methods in those classes JRebel doesn't pick it up. Changes to the code in the localserviceimpl and serviceimpls seems fine in all other regards, and every other class works fine with JRebel. The engineers at ZeroTurnAround swear it works perfectly with Service Builder, but I haven't had success in those aforementioned cases.
Upvotes: 1