Blogs
I wanted to share some testing that I have been doing in terms of patching OSGi modules and adding the patched modules to your own Liferay installations. One of the many benefits to modularity is that it allows for these kinds of changes to be made without having to recompile the whole platform from scratch.
Update: This procedure has been updated to make use of a new feature in Liferay Portal 7 CE GA3 which allows updated modules to override the original module without modifying the original .lpkg file which is much simpler. For more details see the README.
Disclamer: This procedure is only meant for use by Liferay 7 CE. Customers using Liferay DXP should continue to using the patching instructions provided in the offical documentation.
Overview
The example I would like to use is patching the JSP compiler module within Liferay 7 GA3.
There is a few steps that we need to take in order to compile a patched version of the module and then add it to your system. These steps can be used for patching pretty much any module in Liferay. But keep in mind if you run into any issues with your installation its advisable to remove all patched modules and try to recreate the issue using a clean installation of Liferay before you report the issue.
Compiling the custom module
- Clone the com-liferay-portal-osgi-web repository from github: git clone https://github.com/liferay/com-liferay-portal-osgi-web.
-
From within the bnd.bnd file in portal-osgi-web-servlet-jsp-compiler set the version to 2.0.7.IDENTIFIER where IDENTIFIER is whatever you want it to be for example: 2.0.7.PATCH-1.
-
Compile the module by running the following from within the portal-osgi-web-servlet-jsp-compiler directory: gradle assemble.
- This will create a new version of the bundle called com.liferay.portal.osgi.web.servlet.jsp.compiler-2.0.7.PATCH-1.jar in: portal-osgi-web-servlet-jsp-compiler/build/libs
- Rename com.liferay.portal.osgi.web.servlet.jsp.compiler-2.0.7.PATCH-1.jar to: com.liferay.portal.osgi.web.servlet.jsp.compiler.jar removing the version identifier
Deploying the custom module to Liferay
- Copy the patched module into osgi/static/override since the original module resides inside of the Liferay CE Static.lpkg file.
-
Start Liferay
-
Once Liferay is started login to the Gogo shell with telnet localhost 11311 and type: lb | grep 2.0.7.PATCH-1. This should show that your patched module is deployed and running.

