[prev in list] [next in list] [prev in thread] [next in thread] 

List:       maven-user
Subject:    Re: How to delete JSPs after precompilation?
From:       Glen Mazza <glen.mazza () gmail ! com>
Date:       2008-03-31 15:30:17
Message-ID: 16396503.post () talk ! nabble ! com
[Download RAW message or body]


Thanks for the help Oliver.  This was a much more time-consuming task with
Maven than I had was expecting.  We had Jasper errors trying to run the
subsequent WAR on WebLogic, forcing us to revert the tasks to a more manual
process.

For my goal of (1) precompiling the JSPs and (2) removing the JSPs from the
WAR (just keeping the compiled Java classes of those JSPs there), the
problems I came across were:

1.)  The documentation[1] appears to indicate that we can use <exclude/> to
pull out files from the WAR (i.e., those JSPs we no longer need after we
compile them), but numerous attempts to use <excludes/> failed.  Apparently
Maven is redundantly retaining both an <exclude/> and <warSourceExcludes/>
mechanism, or, if they have deprecated the former, need to update its
documentation to indicate that.

2.)  The <warSourceExcludes/> is removing the JSP's *before* they are
compiled into Java classes, so I end up not getting either the JSPs (good)
nor the compiled Java classes (bad) in the WAR file.  There needs to be some
setting to this for me to request that the JSPs be removed *after* they are
compiled.

3.)  The Jasper error we were getting on weblogic might have been because we
did not specify the "jspc-compiler-tomcat5" option as you did below. 
(Another team member reverted this method without knowing to test this.) 
I'll need to see if this was indeed the problem we were having on Weblogic,
and if so, to submit a bug report/patch to have the Maven docs updated with
the Tomcat compiler info you list below.

Regards,
Glen

[1]
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html



olivier jacob wrote:
> 
> Hello again :)
> 
> Now I've the configuration at hand, here it is :
> 
> <plugin>
> <groupId>org.codehaus.mojo.jspc</groupId>
> <artifactId>jspc-maven-plugin</artifactId>
> <executions>
> <execution>
> <goals>
> <goal>compile</goal>
> </goals>
> </execution>
> </executions>
> 
> <!-- Use Tomcat 5.x compiler -->
> <dependencies>
> <dependency>
> <groupId>org.codehaus.mojo.jspc</groupId>
> <artifactId>jspc-compiler-tomcat5</artifactId>
> <version>2.0-alpha-1</version>
> </dependency>
> </dependencies>
> </plugin>
> 
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <configuration>
> <webXml>${pom.basedir}/target/jspweb.xml</webXml>
> 
> <warSourceExcludes>**/*.jsp,**/*.jspf</warSourceExcludes>
> </configuration>
> </plugin>
> 
> Looks a lot easier to me.
> 
> Olivier
> 
> On Thu, Mar 27, 2008 at 11:37 PM, Glen Mazza <glen.mazza@gmail.com> wrote:
> 
> > 
> > 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> 
> 
> -- 
> Olivier Jacob
> Consultant - OCTO Technology
> 50, avenue des Champs Elysées
> 75008 Paris
> 
> 

-- 
View this message in context: \
http://www.nabble.com/How-to-delete-JSPs-after-precompilation--tp16331157s177p16396503.html
 Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic