Legacy Knowledge Base
Published Jul. 2, 2025

How to exclude precompiled JSP files from the original module when extending modules?

Written By

Jose L. Bango

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • After implementing and deploying an extended module, changes in JSP files are not shown.
  • When extending modules, how can I prevent precompiled original JSPs from being included in the resulting JAR?

Environment

  • Liferay DXP 7.0+

Resolution

  • The problem is that the custom module is packaged with all the resources of the overwritten module, while custom JSPs are not compiled. Then, the JSP servlet will load the compiled JPSs from the original module instead of the new JSP files.
    • If you open the JAR file, you can see the precompiled JPS files from the original module in org/apache/jsp.
  • You can workaround this behavior by preventing the original JSP files from being included in the JAR:
    • If your custom module utilizes bnd.bnd:
      • Using Include-Resource header:
        • Before: 
          Include-Resource: @com.liferay.example-4.0.33.jar
        • After: 
          Include-Resource: @com.liferay.example-4.0.33.jar!/!org/apache/jsp/**
      • Using -includeresource directive:
        • Before: 
          -includeresource: @com.liferay.example-4.0.33.jar
        • After: 
          -includeresource: @com.liferay.example-4.0.33.jar!/!org/apache/jsp/**
    • If you are developing an ext module with no bnd.bnd, you can customize your build.gradle file by adding:
      jar {
      exclude("org/apache/jsp/**")
      }

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base