Mastering Liferay Workspaces and Tooling

Course Overview

Getting Started with Client Extensions

Client Extensions are the go-to solution for extending Liferay DXP, whether you are modifying the platform’s look and feel or adding custom functionality. Unlike traditional OSGi plugins or themes, which modify or add functionality to Liferay itself, client extensions interface only with Liferay’s headless APIs and live outside the portal container. Liferay recommends the client extension framework as the primary method for expanding and enhancing the out-of-the-box experience. There are four main categories of client extensions you can implement: frontend, microservice, configuration, and batch.

Because client extensions run outside of Liferay, you can create them with whatever programming languages or technologies you prefer. This decoupling ensures that custom solutions remain intact even as the platform undergoes updates, significantly reducing maintenance overhead. At the same time, they integrate seamlessly with Liferay Workspace, so that your extensions feel like a native part of the Liferay development process.

Client extensions not only make solutions more maintainable and flexible, but also improve application performance and flexibility. By selectively applying extensions to specific pages or components, organizations such as Clarity can optimize resource utilization and enhance user experiences. Additionally, you can deploy client extensions to any Liferay environment: Liferay SaaS, Liferay PaaS, and Liferay Self-Hosted. Client extensions make customization with Liferay scalable, agile, and future-proof.

Starting a Client Extension Project

You can create client extension projects directly inside your Liferay workspace. These projects reside in the [WORKSPACE_ROOT]/client-extensions folder. This folder is not included by default, so you’ll need to create it in your workspace’s root directory when you complete the exercise.

Inside the client-extensions folder, you’ll create separate sub-folders for each client extension project you implement in your solution. Projects may contain one or more client extensions grouped together as a unit, and separate projects can interact with one another. (See which types of client extensions can be grouped here.) Every project includes a client-extension.yaml file that defines extension properties and deployment instructions. When you build a project with Gradle, it produces a deployable *.zip archive called a Liferay Universal File Format Archive (LUFFA).

As the needs of your organization grow, client extension projects can quickly scale in complexity. Clarity’s team wants to deploy a simple extension as a proof of concept, and right now they don’t have the resources to learn how to develop a client extension project from scratch. Fortunately, Liferay provides the resources for them to hit the ground running.

Liferay Sample Workspace

Liferay offers a comprehensive collection of sample projects to fast-track your client extension development. You can find the sample workspace in Liferay’s GitHub repository here. The README includes short descriptions of each sample project, along with Liferay’s naming conventions for client extensions. 

To begin working on a client extension, Liferay recommends using one of the provided sample projects as a starting point. First, clone the sample workspace from GitHub to your machine. You can do this through GitHub's UI.

Once you’ve cloned the sample workspace, you can copy the appropriate client extension project over to the client-extensions folder in your local Liferay workspace directory. Then, in the client-extension.yaml file, you can update the identifier fields that are relevant to your project. 

Updating Your Gradle Plugin Version

Liferay Workspace regularly receives updates with bug fixes and additional extension types with which you can build more comprehensive applications. To ensure that your solutions are supported, Liferay recommends you update your workspace plugin to the latest version so that you can use the latest client extension features. This version is set within your settings.gradle file. To check what version is available, visit this link to see the latest version number: Maven Central

Conclusion

Client extensions are a vital component of your Liferay development toolkit. With Liferay Workspace, building and deploying extensions becomes an integrated part of the DXP experience. Next, you’ll go through the process of creating a client extension for Clarity.

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy