Legacy Knowledge Base
公開されました Jul. 2, 2025

モジュールを拡張する際に、元のモジュールからコンパイル済みのJSPファイルを除外する方法は?

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.

問題

  • 拡張モジュールの実装・展開後、JSPファイルの変更点は表示されません。
  • モジュールを拡張する際、コンパイル済みのオリジナルJSPが結果のJARに含まれないようにするにはどうすればよいですか?

Environment

  • Liferay DXP 7.0+

解決策

  • 問題は、カスタムモジュールは上書きされたモジュールのすべてのリソースがパッケージ化されるのに対し、カスタムJSPはコンパイルされないことです。 すると、JSPサーブレットは、新しいJSPファイルの代わりに、元のモジュールからコンパイルされたJPSをロードすることになります。
    • JARファイルを開くと、 org/apache/jspにオリジナルモジュールからプリコンパイルされたJPSファイルを見ることができます。
  • この動作は、元のJSPファイルがJARに含まれないようにすることで回避できます:
    • カスタムモジュールが bnd.bndを利用する場合:
      • Include-Resource ヘッダーを使用します:
        • 前:
          Include-Resource: @com.liferay.example-4.0.33.jar
        • 後:
          Include-Resource: @com.liferay.example-4.0.33.jar!/!org/apache/jsp/**
      • -includeresource ディレクティブを使用しています:
        • 前:
          -includeresource: @com.liferay.example-4.0.33.jar
        • 後:
          -includeresource: @com.liferay.example-4.0.33.jar!/!org/apache/jsp/**
    • bnd.bndがない ext モジュールを開発する場合、 build.gradle ファイルを追加することでカスタマイズすることができます:
      jar {
      exclude("org/apache/jsp/**")
      }

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base