If you’ve explored Liferay DXP 7.0’s features and possibly created new portlet modules themes with Liferay’s new tooling and techniques, you may be wondering how you’d upgrade existing plugins. The great thing is that Liferay has automated much of the upgrade process. In addition, you can continue developing plugins in traditional ways and adopt new development tooling and techniques when you’re ready.
This tutorial guides you through phases of upgrading plugins and optionally optimizing them.
Upgrade: A process for deploying an existing plugin on Liferay DXP 7.0 with minimal changes.
Optimization: An optional but recommended process for modifying a plugin or migrating it to a new environment to improve the plugin or facilitate developing it.
Importantly, you should upgrade a plugin before applying any optimizations to it.
The good news is that upgrading plugins to Liferay DXP 7.0 is straightforward. For Plugins SDK and Maven projects, Liferay Developer Studio’s Upgrade Planner automates much of the process. In addition, the upgrade tutorials demonstrate any remaining upgrade steps.
You can deploy plugins to Liferay DXP 7.0 as you have for previous releases (e.g.,
ant clean deploy). Since everything in Liferay DXP 7.0 runs as OSGi modules,
however, you might wonder how traditional WAR-style plugins can run on it. The
answer: Liferay’s Plugin Compatibility Layer.
The Plugin Compatibility Layer converts standard WARs to Web Application Bundles (WABs). WABs are full-fledged OSGi modules. The Plugin Compatibility Layer’s WAB Generator supports deploying traditional plugins and web applications that contain Servlets, JSPs, and other Java web technologies without making any OSGi specific changes to them.
Note, you can still use an application server’s mechanisms to deploy regular web applications along with Liferay DXP, without using the Plugin Compatibility Layer.
After upgrading your plugins you can consider optimizations such as these:
- Migrating plugins to Gradle or Maven to leverage their development commands and rich Liferay plugin templates.
- Migrating themes to the Liferay Theme Generator to add Themelets (new) and to leverage Node.js, Yeoman, and Gulp.
- Converting plugins to modules to leverage Declarative Services, extendability, and more modularity benefits.
- Using the Lexicon, to apply a clean consistent application user experience.
See the optimization tutorials for more options and details.
You can continue using the Plugins SDK to develop plugins. But the Plugins SDK is deprecated as of Liferay DXP 7.0. In light of the deprecation, you should consider migrating plugins from the Plugins SDK to one of the new environments:
- Liferay Workspace
is a Gradle environment that supports developing modules and traditional
migrateWar commandmoves Plugins SDK portlets to Liferay Workspace (Workspace) in a snap.
- Liferay’s Maven plugins and archetypes support developing modules and traditional plugins. There’s also a Liferay Workspace archetype for generating a Workspace that uses Maven.
In short, there’s plenty of time to move plugins out of the Plugins SDK, but you should at least plan for migrating to a new environment that works best for you.
Speaking of planning, properly planned upgrades and optimizations reduce the time and effort they take. To help guide you through the upgrade and optimization tutorials, you get these things:
- Upgrade and optimization phase descriptions
- Upgrade and optimization paths
Follow these upgrade and optimization phases:
Read the applicable upgrade tutorials for your plugin. Examine the upgrade and optimization paths.
Upgrade the plugin, making only the minimal changes necessary for it to work on Liferay DXP 7.0.
(Optional) Identify and apply only the most beneficial optimizations for your plugin.
(Optional) Apply additional optimizations as desired.
The following tables provide upgrade and optimization paths for 6.2 plugins and features.
|Feature||Upgrade path||Optimizations (optional)|
|JNDI data source||Use Liferay DXP’s classloader to access the app server’s JNDI API||None|
|Resources Importer||Update the Resources Importer||None|
|Services - Invoke a service from Liferay DXP Core or another portlet or module||Implement a Service Tracker||Invoke Liferay services from a module|
|Services - Module dependency||Copy ||- Migrate to Gradle/Maven and add dependency on the OSGi service|
|Services - Service Builder||Upgrading Portlets that use Service Builder||Convert to OSGi modules, e.g., |
|Services - Web services||1. Adapt code to API|
2. Resolve dependencies
|Use a Service Builder service with JAX-RS with a REST service in front|
|Template - FreeMarker||- Adapt code to API|
- Adapt Theme templates
|Template - Velocity (deprecated)||Adapt code to API||Convert to FreeMarker|
Now you have a game plan and a cheat sheet for upgrading and optimizing plugins with confidence.