Overview This guide walks through creating two OSGi modules in Liferay 7.4 and sharing a Java package between them using the standard API + Implementation pattern. This is the most common and correct approach for exposing reusable services in a Liferay-based architecture. In OSGi, a bundle (module) does not expose its internal packages by default — everything is private unless explicitly exported. To share code between modules, the standard practice is to split functionality into: · An API module — contains interfaces/DTOs and exports the package · A Service (Implementation) module — implements the interface, imports the package, and registers the implementation as an OSGi component/service The consuming module then simply imports the API package and looks up the service using @Reference injection. Step 1: Create the API Module Using Liferay Workspace + Blade CLI, generate a new API module: blade create -t api -p com.sgc.greeting greeting-api This generates a Gradle module unde...
Introduction to Client Extensions Liferay 7.4 introduced Client Extensions (CX) as a paradigm shift in how developers extend and customize the Liferay DXP platform. Unlike traditional OSGi modules that require deployment inside the Liferay runtime, Client Extensions run outside the portal — making them language-agnostic, independently deployable, and significantly easier to maintain. This guide walks you through building a fully functional React-based Client Extension (Custom Element) that integrates with Liferay's Headless Delivery API, and then covers every major Client Extension type available in Liferay 7.4. Why Client Extensions? Client Extensions decouple frontend and backend concerns. You can build in React, Vue, Angular, or plain JavaScript — without touching the portal's OSGi container. Deployments become simpler, CI/CD pipelines become faster, and teams can work independently. Client Extension Types at a Glance...