Upgrading Vaadin in Liferay...
Vaadin And Liferay #
Vaadin is a framework based upon the GWT to create servlets and portlets exclusively in Java. Since it is based on GWT, Vaadin-based portlets get the benefit of an ajax-aware environment that keeps the client browser in sync with the server side components.
Liferay ships with a dated version of Vaadin. As of this writing, version 6.8.2 is available for download from Vaadin, but Liferay 6.1 GA2 ships with version 6.7.4.
Keeping current with Vaadin is necessary because each Vaadin dot release contains fixes for the underlying CSS and widgets used in Vaadin-based portlets.
That said, updating your Vaadin version is not clearly documented. This wiki page hopes to address that...
Option 1 - Manual Update #
This is probably the easiest way to do the update, although it is done directly on the Liferay application server. If you are going to want to deploy your Vaadin update in a normal Liferay manner, check out Option 2.
- First go to Vaadin Releases and download the "Vaadin 6 Jar-only for all platforms". The jar will be named with the release version, i.e. vaadin-6.8.2.jar.
- Also download the "Vaadin 6 Liferay update package". This will also be named with the version number, i.e. vaadin-6.8.2-liferay.zip.
- Rename the Vaadin jar to remove the version number, i.e. from vaadin-6.8.2.jar to simply vaadin.jar.
- Copy the vaadin.jar to the /WEB-INF/lib directory of the Liferay web application, replacing the version of the file that is there to the new version you've just downloaded. Actual location may will vary depending upon your environment, but for a tomcat bundle it would go to webapps/ROOT/WEB-INF/lib.
- Unzip the Liferay update package to the /html directory of the Liferay web application, overwriting existing contents. Actual location may vary depending upon your environment, but for a tomcat bundle it should be webapps/ROOT/html.
- Restart the application server.
- Recompile the widgetset. You should have the Vaadin ControlPanel for Liferay installed if you are using Vaadin. Use the control panel to recompile the widgetset.
- Redeploy your Vaadin-based portlet projects (you did have vaadin.jar listed in your liferay-plugin-package.properties file as you should, and didn't manually copy vaadin.jar in, right?).
At this point your Vaadin has been updated to the latest version and you're ready to go.
Option 2 - Deployable Artifacts #
I personally prefer this option as I can create and deploy the artifacts to any Liferay instance simply by dropping them into Liferay's deploy directory.
Start by following steps 1 through 3 of Option 1 above.
EXT Plugin #
If you aren't using an EXT plugin for your Liferay environment, you need to create one now. Use the Liferay IDE to create an EXT plugin.
Copy the vaadin.jar to the EXT project's /docroot/WEB-INF/ext-lib/portal directory. If you're using any addons downloaded from Vaadin.com, this is also where you would put the jars.
Build and deploy your EXT plugin and Liferay's vaadin.jar will be automagically updated to use the version of the vaadin jar you've downloaded.
Vaadin Hook #
The vaadin.jar has been updated, but you still need to update the Vaadin files in the /html/VAADIN directory.
Using the Liferay IDE, create a hook plugin.
In the docroot folder, create a folder named "vaadin", and inside that folder create a folder named "html".
Extract only the VAADIN/themes files from the Liferay update package to the /docroot/vaadin/html folder. You should not include the widgetsets in the hook, only the themes. After extraction and refresh of your hook plugin project, you should now have a /docroot/vaadin/html/VAADIN/themes folder.
You do not want to include the widgetsets folder in your hook. The reason is the widgetsets are actually compiled for your local environment using the Vaadin ControlPanel for Liferay. If you include the widgetsets in your hook, when it is deployed it will replace your compiled widgetsets with the stock widgetsets that came from the release, and you don't want that to happen.
Your liferay-hook.xml file for this hook will be:
<?xml version="1.0"?> <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.0.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_0_0.dtd"> <hook> <custom-jsp-dir>/vaadin</custom-jsp-dir> </hook>
Note: DTD versioning may be different depending upon your local development environment. Let the IDE take care of the version, but focus on the contents.
Build and deploy your hook plugin and Liferay's /html/VAADIN/themes directory will be automagically updated with the new version.
This hook plugin also becomes your 'theme' project for tweaking the Vaadin themes. Make your changes in /docroot/vaadin/html/VAADIN/themes/<theme>/styles.css, then build and deploy your hook to have the theme changes applied.
Post-Upgrade Stuff #
Just as in the manual process, after the EXT and hook plugins are deployed, you should recompile the widgetsets using the Vaadin ControlPanel for Liferay and re-deploy your Vaadin-based plugins.
Option 3 - Globalize the Vaadin Jar #
Your last option is to move the vaadin.jar from Liferay's WEB-INF/lib directory and put it in the global lib directory of your application container. If you have a lot of Vaadin-based portlets this will save you from having to redeploy them all after the upgrade.
You'll still need to do the theme update (I suggest using the hook process described above for this) and recompile the widgetsets.
You can also choose to globalize your addons. I would only put your commonly-used addons in the global lib directory (i.e. the LiferayIPC addon, for example, if you're using that a lot), but keep infrequently used addons in the EXT plugin and pull them into Vaadin projects using the liferay-plugin-package.properties file.
Note: I really haven't tried the globalize option yet, although I plan on trying it out, so you may end up with mixed results choosing this option. I can say, from experience, that Options 1 and 2 will work.
Option 4 - Use Vaadin control panel for Liferay #
You can install Vaadin control panel for Liferay, by downding it from https://vaadin.com/directory#addon/vaadin-control-panel-for-liferay. You need to have Vaadin account, but that won't cost anything.
With Vaadin control panel you can upgrade Vaadin with inside Liferay just by pressing button.