If you’ve explored Liferay DXP 7.1’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.1 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.1 is straightforward. For Plugins SDK and Maven projects, Liferay Dev Studio DXP’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.1 as you have for previous releases (e.g.,
ant clean deploy
). Since everything in Liferay DXP 7.1 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 Clay, to apply a clean consistent application user experience.
See the optimization tutorials for more options and details.
The Plugins SDK is no longer available to develop plugins for Liferay DXP 7.1. Visit the Deprecated Apps in 7.1: What To Do article for more information on the Plugins SDK removal.
In light of the removal, 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
plugins.
Blade’s
migrateWar command
moves 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.
Liferay Dev Studio DXP supports developing in Workspaces using Gradle or Maven.
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
Upgrade and Optimization Phases
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.1.
-
(Optional) Identify and apply only the most beneficial optimizations for your plugin.
-
(Optional) Apply additional optimizations as desired.
Plugin Upgrade and Optimization Paths
Feature Upgrade and Optimization Paths
Feature | Upgrade path | Optimizations (optional) |
---|---|---|
JNDI data source | Use Liferay DXP’s classloader to access the app server’s JNDI API | 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 x-service.jar to WEB-INF/lib | - 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., x-api and x-service |
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 | None |
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.