Hi Karthik,
A build file I modified from the sample that comes with tomcat
documentation, hope it's still working (I removed some private stuff
from the original file)
You will need to set the properties
webapp.name (eg. myWebapp) and tomcat.home (eg. d:/tomcat) in the file
build.properties and run the task all (ant all).
Basically, the script will pre-compile all JSPs into the work folder of
tomcat and not the WEB-INF/classes directory. Also you don't have to
change web.xml to include the generated servlets.
project name=Webapp Precompilation default=all basedir=.
property name=propFile value=build.properties /
property file=${propFile} /
!--
property name=tomcat.home value=path to tomcat /
--
property name=webapp.path
value=${tomcat.home}/webapps/${webapp.name} /
property name=src.dest.dir
value=${tomcat.home}/work/Catalina/localhost/${webapp.name} /
property name=class.dest.dir
value=${tomcat.home}/work/Catalina/localhost/${webapp.name} /
target name=jspc
taskdef classname=org.apache.jasper.JspC name=jasper2
classpath id=jspc.classpath
pathelement location=${java.home}/../lib/tools.jar/
fileset dir=${tomcat.home}/bin
include name=*.jar/
/fileset
fileset dir=${tomcat.home}/server/lib
include name=*.jar/
/fileset
fileset dir=${tomcat.home}/common/lib
include name=*.jar/
/fileset
/classpath
/taskdef
jasper2
validateXml=false
uriroot=${webapp.path}
webXmlFragment=${webapp.path}/WEB-INF/generated_web.xml
outputDir=${src.dest.dir} /
/target
target name=compile
mkdir dir=${class.dest.dir}/
mkdir dir=${webapp.path}/WEB-INF/lib/
javac destdir=${class.dest.dir}
optimize=off
debug=on failonerror=false
srcdir=${src.dest.dir}
excludes=**/*.smap
memoryMaximumSize=256M fork=true
classpath
pathelement location=${webapp.path}/WEB-INF/classes/
pathelement location=${class.dest.dir}/
fileset dir=${webapp.path}/WEB-INF/lib
include name=*.jar/
/fileset
pathelement location=${tomcat.home}/common/classes/
fileset dir=${tomcat.home}/common/lib
include name=*.jar/
/fileset
pathelement location=${tomcat.home}/shared/classes/
fileset dir=${tomcat.home}/shared/lib
include name=*.jar/
/fileset
fileset dir=${tomcat.home}/bin
include name=*.jar/
/fileset
/classpath
include name=** /
exclude name=tags/** /
/javac
/target
target name=print-info
echo message=*** Precompiling all JSPs for webapp:
${webapp.name} *** /
/target
target name=all depends=print-info, jspc, compile
/target
!--
Removed compiled JSP source and classes.
--
target name=clean depends=
echo message=Deleting compiled JSP source from
directory ${src.dest.dir}/org/apache/jsp /
delete includeEmptyDirs=true
fileset dir=${src.dest.dir}/org/apache/jsp
includes=**/*.java /
/delete
echo message=Deleting compiled JSP class from
directory ${class.dest.dir}/org/apache/jsp /
delete includeEmptyDirs=true
fileset dir=${class.dest.dir}/org/apache/jsp
includes=**/*.class /
/delete
/target
/project
- Jim
-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED]
Sent: Monday, February 28, 2005 4:29 PM
To: Tomcat Users List; BV Karthik
Subject: Re: Pre-Compilation in Tomcat Jasper
there is one jspc.bat in bin directory or an Ant task - JspC is
available for pre compiling jsp. Using this you can compile JSP to
Servlets and put it in WEB-INF/classes directory. It has parameter to
generate the required web.xml mappings.
Note : In Tomcat 4.1.x the task by default compiles all classes into
org.apache.jsp.
rgds
Antony Paul
On Mon, 28 Feb 2005 12:25:46 +0530, BV Karthik
[EMAIL PROTECTED] wrote:
Hi,
Is there anything in Tomcat which will pre-compile our JSP's?
What jasper has to do with Tomcat?
Pls help. Thanks in advance.
Regards,
Karthik BV
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorized. If you are not
an intended recipient, please notify the sender of this email
immediately. You should not copy, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.
http://www.capco.com