In Ant 1.5 there is an optional task JspC that uses the same Apache Jasper
class.  This is how we use it with Tomcat 4.0.6:

  <path id="jspc.classpath">
    <path refid="web.classpath"/>
    <pathelement location="${tomcat.home}/lib/jasper-compiler.jar"/>
    <pathelement location="${tomcat.home}/lib/jasper-runtime.jar"/>
    <pathelement location="${tomcat.home}/common/lib/xerces.jar"/>
  </path>

  <target name="jspc" depends="init">
    <mkdir dir="${web.dir}/jsp"/>
    <jspc srcdir="${web.dir}"
          destdir="${web.dir}/jsp"
          package="org.apache.jsp">
      <classpath refid="jspc.classpath"/>
      <include name="**/*.jsp"/>
    </jspc>
  </target>

And then we make sure they compile, etc.

--
Chris Bonham
President/CEO
Third Eye Consulting, Inc.
[EMAIL PROTECTED]
http://www.thirdeyeconsulting.com
317.823.3686
317.823.0353 (FAX)

Quoting Neal Sanche ([EMAIL PROTECTED]):
> > I am using jboss with tomcat. I want to precompiled my JSP pages, how
> > will I do that.
> 
> The Jetty FAQ indeed has a very good description of how this is done. I
> was able to follow those directions and get my JSPs precompiled for use
> under JBoss using ANT to do the dirty work.     
> 
> <target name="do-precompile-jsp" unless="precompile-jsp.notRequired"> 
>   <!-- PRECOMPILE the .jsp pages -->
>   <echo message="Generating JSP code..."/>
>        <java classname="org.apache.jasper.JspC" fork="true">
>             <classpath>
>            <pathelement
>                   
>location="${jboss.dir}/server/default/deploy/jbossweb.sar/org.apache.jasper.jar"/>
>            <pathelement
>                   location="${jboss.dir}/server/default/lib/javax.servlet.jar"/>
>              <pathelement location="${jboss.dir}/lib/crimson.jar"/>
>              <pathelement location="${output.dir}"/>
>             </classpath>
>             <arg value="-d"/>
>           <arg value="${jsp.precompile.dir}" />
>           <arg value="-p"/>
>           <arg value="${application.name}"/> 
>           <arg value="-webinc"/> 
>           <arg value="${gen.mappings}"/> 
>           <arg value="-webapp"/> 
>           <arg value="${webapp.dir}/frontend"/>
>        </java> 
>        
>        <echo message="Precompiling JSPs..."/> 
>        
>        <javac srcdir="${jsp.precompile.dir}" 
>            destdir="${jsp.precompile.output.dir}" 
>          classpathref="jsp.precompile.path"
>          debug="${javac.debug}"
>          optimize="${javac.optimize}" 
>          deprecation="${javax.deprecation}"/> 
>          
>        <echo message="Merging servlet definitions into web.xml"/> 
>        <loadfile property="jsp.servlets.text" srcFile="${gen.mappings}"/>
>        <copy file="${webapp.dir}/frontend/WEB-INF/web.xml" overwrite="true" 
>            todir="${webapp.dependency.dir}/WEB-INF" filtering="true">
>            <filterset begintoken="&lt;" endtoken="&gt;">
>              <filter token="!-- JSP Servlet Insertion Point --"
>                value="${jsp.servlets.text}"/>
>            </filterset> 
>        </copy> 
> </target>
> 
> I apologize for the dismal formatting of the above XML, your variable
> declarations will vary. I also thing the filtering copy operation is
> somewhat new to ANT, but is available in 1.5.1 and later. All you have
> to do is add a line <!-- JSP Servlet Insertion Point --> to your
> web.xml. The copy operation is meant to copy and filter your 'source'
> web.xml into a place where it will be used to build your .war file.
> The reason I used a comment was because I've got my ANT scripts setup
> to allow me to turn off precompiliation if I want to.
> 
> Hope this helps.
> 
> -Neal
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:  The Best Geek Holiday Gifts!
> Time is running out!  Thinkgeek.com has the coolest gifts for
> your favorite geek.   Let your fingers do the typing.   Visit Now.
> T H I N K G E E K . C O M        http://www.thinkgeek.com/sf/
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user


-------------------------------------------------------
This SF.NET email is sponsored by:  The Best Geek Holiday Gifts!
Time is running out!  Thinkgeek.com has the coolest gifts for
your favorite geek.   Let your fingers do the typing.   Visit Now.
T H I N K G E E K . C O M        http://www.thinkgeek.com/sf/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to