Maven WAR Overlays are wonderful things, allowing for manipulation of a WAR artifact published by someone else into what you need for your application.
Pre-compiling JSPs (JSPC) is great when you don't want users to potentially be hit with the wait for your container to compile the JSP on first visit.
Here is how to put the two together:
In the above example the following things are happening:
- The org.jasig.portlet:WeatherPortlet WAR artifact is declared as a dependency. This is the WAR that will have its JSPs compiled.
- Due to operation ordering the maven-war-plugin is split into two executions.
- First the build-directory-tree execution extracts the overlay WAR during Maven's process-resources phase. This ensures the WAR contents are in place before JSPC runs.
- Second the build-war execution re-packages the WAR using the JSPC generated XML file as the web.xml included in the WAR.
- The JSPC plugin is configured to look in the target directory for the web.xml to modify and the JSPs to compile.
: