It’s common to create portlets that extend
GenericPortlet provides a default
implementation. Upgrading a
GenericPortlet is straightforward and takes only
Adapt the portlet to Liferay DXP 7.1’s API using the Liferay Upgrade Planner.
Resolve its dependencies.
This tutorial demonstrates upgrading a Liferay Plugins SDK 6.2 sample portlet
called Sample DAO (project
The sample portlet lets users view, add, edit, and delete food items from a listing. For reference, you can download the pre-upgraded portlet code and the upgraded code.
The sample portlet has the following characteristics:
- View layer implemented by JSPs
- Persists models using the Data Access Object (DAO) design pattern
- Specifies database connection information in a properties file
- Manages dependencies via Ant/Ivy
- Developed in a Liferay Plugins SDK 6.2
The portlet uses a traditional Plugins SDK portlet project folder structure.
GenericPortlet portlets involves these steps:
Since the sample portlet’s dependencies haven’t changed, upgrading it involves only adapting the code to Liferay DXP 7.1’s API. The Liferay Upgrade Planner facilitates updating the code and resolving compilation issues quickly.
You deploy a
GenericPortlet to Liferay DXP 7.1 in the same way you deploy to
Portal 6.x. When the plugin WAR file lands in the
folder, Liferay DXP’s Plugin Compatibility Layer converts the WAR to a Web
Application Bundle (WAB) and installs the portlet as a WAB to Liferay DXP’s OSGi
On deploying an upgraded portlet, the server prints messages that indicate the following portlet status:
- WAR processing
- WAB startup
- Availability to users
Deploying the sample portlet produces messages like these:
2018-03-21 17:44:59.179 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:262] Processing sample-dao-portlet-184.108.40.206.war ... 2018-03-21 17:45:09.959 INFO [Refresh Thread: Equinox Container: 0012cbb0-7e2c-0018-146e-95a4d71cdf95][PortletHotDeployListener:298] 1 portlet for sample-dao-portlet is available for use ... 2018-03-21 17:45:10.151 INFO [Refresh Thread: Equinox Container: 0012cbb0-7e2c-0018-146e-95a4d71cdf95][BundleStartStopLogger:35] STARTED sample-dao-portlet_220.127.116.11 
The portlet is now available on Liferay DXP.
You’ve learned how to upgrade and deploy a portlet that extends
GenericPortlet. You adapt the code, resolve dependencies, and deploy the
portlet as you always have. It’s just that easy!
Migrating Plugins SDK Projects to Workspace and Gradle
Using Dependency Management Tools