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


  • 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?


  • Liferay DXP 7.0+


  • 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 {

Additional Information

¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0