Overriding Module JSP in Liferay 7 using Liferay IDE

With the release of Liferay IDE 3.1 M1 ,I noticed one more interesting feature that developers might be looking for, is that jsp of the OOTB module JSPs  can be modified using Liferay Module Fragment project in Liferay IDE 3.1 M1. One approach to override module JSPs is mentioned on page.

As described below , JSPs fragment can also be generated using Liferay IDE 3.1 M1.

Create new module fragment project.

 

Configure Liferay Runtime environment and select it as shown below.

As next step, now select the Host OSGI bundle.

After selecting the Host OSGI bundle, need to select the jsp  you want to override in the selected module.

So after selecting Host OSGI bundle and file that need to override, it is almost done. Click finish to proceed further, it will create Module Fragment Project structure. In the generated project structure , if we see file blog-fragment/bnd.bnd .

Following two entries are important to add that is mentioned on the page.

Fragment-Host: com.liferay.blogs.web;bundle-version="2.0.0"

In the generated module fragment project , selected jsp is also added that can be modiefied.

 

 

Now Build the above created module fragment project using the build Gradle task. 

It will generate the packaged JAR in blog-fragment/build/lib folder. Deploy the generated JAR to see the changes.

Blogs

I tried this on 7.3.5 but getting very weird behavior, I have created the workspace and after this module fragment , after this jar file is generated using maven . When I deployed this jar filegetting this on server logs.2021-05-22 13:24:33.417 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:271] Processing account-fragment-1.0.0.jar2021-05-22 13:24:42.636 INFO  [Refresh Thread: Equinox Container: 2844c29c-9742-458d-9559-cb882152f613][BundleStartStopLogger:49] STOPPED com.liferay.users.admin.web_5.0.32 [2411]2021-05-22 13:24:43.774 INFO  [Refresh Thread: Equinox Container: 2844c29c-9742-458d-9559-cb882152f613][BundleStartStopLogger:46] STARTED com.liferay.users.admin.web_5.0.32 [2411]But there UI changes are not there whatever UI  changes I did is not showing , but when I remove the init file there is error on UI comes up , If jar is getting executed then why UI changes is not showing UP and if not then how Error on UI comes up by removing init file

I implemented the following steps and it may be useful for beginners in future

Steps for Create Liferay JSP fragment hook 1. Create a new Liferay Fragment Module Project 2. Select the required HOST OSGI Bundle: 3. Select Override FilePath for Override 4. Verify Project Structure 5. Verify and Understanding Liferay bnd.bnd file 6. Build and Deploy using Gradle/Maven Task

Read here:  https://aspiresoftware.in/blog/jsp-fragment-hook-in-the-liferay-7/