I found the answer to my problem and would like to save it here for the
archives.
The basic process I followed was: after the WAR is created, use the
maven-antrun-plugin to open it up, delete the JSP's, and rezip the WAR. To
do this, I added the following execution to my maven-antrun-plugin <plugin/>
as follows:
<execution>
<phase>pre-integration-test</phase>
<id>removeJSPs</id>
<configuration>
<tasks>
<unzip
src="${project.build.directory}/${project.build.finalName}.war"
dest="${project.build.directory}/myTmp" />
<delete>
<fileset dir="${project.build.directory}/myTmp"
includes="**/*.jsp" />
</delete>
<delete
file="${project.build.directory}/${project.build.finalName}.war" />
<zip basedir="${project.build.directory}/myTmp"
destfile="${project.build.directory}/${project.build.finalName}.war"/>
<delete dir="${project.build.directory}/myTmp" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
I chose the "pre-integration-test" phase so it runs right after the
"package" (WAR creation) phase[1]. The process above also creates a
temporary "target/myTmp" folder to do the opening and re-zipping of the WAR
file. The last <delete/> above removes it.
[1]
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference
Glen Mazza wrote:
>
> Hello All,
>
> The page[1] below nicely shows us how to precompile JSPs before the WAR is
> created. It works perfectly well. Problem is though, we have an
> additional requirement to delete the JSPs after they are precompiled, so
> that no JSPs are in the WAR (only their compiled versions are to stay.)
> How can we modify [1] below--what else do we need to do--to delete the
> JSPs *before* the WAR is created?
>
> This is what we have tried:
>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <phase>process-classes</phase>
> <id>deploy</id>
> <configuration>
> <tasks>
> <delete>
> <fileset
> dir="${project.build.directory}/${project.build.finalName}"
> includes="**/*.jsp" />
> </delete>
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
> But we can't get it to work--either the generated resources directory it
> looks in is not yet created, perhaps we've gotten the goal and/or phase
> mixed up, or? Any help would be much appreciated!
>
> Regards,
> Glen
>
> [1] http://mojo.codehaus.org/jspc-maven-plugin/usage.html
>
--
View this message in context:
http://www.nabble.com/How-to-delete-JSPs-after-precompilation--tp16331157s177p16339518.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]