A module is a Liferay 7 plugin. Architecturally, a module is simply a group of Java classes, a MANIFEST.MF file, and additional optional resources packaged together as a JAR file. Liferay applications usually consist of at least two or three modules. For example, a typical Service Builder application consists of a web module, service module, and API module. A module can also contain one or more Components.
Liferay 7 introduced a major improvement: an OSGi-based module framework to which plugins are deployed. Liferay’s module framework makes it easier for developers to create Liferay applications and to customize Liferay. You can visit the Migrating a Liferay 6 Application section of tutorials to learn when and how to convert legacy applications to modules.
As a developer, you benefit from Liferay's module framework in many ways:
- Liferay's module framework makes it easier to manage dependencies. Individual modules export code at the package level for use by other modules.
- Liferay modules hide their internals from other modules. Since the internals are hidden from other modules, developers are free to change the internals whenever needed.
- Modules publish services to and consume services from a service registry. Service contracts are loosely coupled from service providers and service consumers.
- Liferay's module framework dynamically manages module lifecycles. Modules can be installed, started, updated, stopped, and uninstalled while Liferay is running. This makes it very easy for Liferay developers to update their plugins and check their functionality.
- Deployment is easy and straightforward, and the process doesn't vary according to application server or servlet container.
- Liferay modules are carefully versioned and explicitly declare dependencies on specific versions of other modules. This solves the problem of having two applications that depend on different versions of the same library. In Liferay's module framework, the two applications can each depend on their own versions of the library.
- Liferay's module framework is small, fast, and secure.
- Liferay's module framework is OSGi-based.
To learn more about Liferay's module framework used in Liferay 7, visit OSGI and Modularity.