Hello,
What is your error when you execute ant and what is the version of tomcat? is it a classpath error?
Did you have a look at the build.xml we use to precompile the jsp in Jahia? You will find the code here http://cvspub.jahia.org/cgi-bin/cvsweb.cgi/jahia/Attic/build.xml?rev=1.59.4.1;content-type=text%2Fplain The target is "jsp-compile" and depends jspc target.
Philippe. At 13.07.2004 09:37, you wrote:
I want to precompile all my JSP templates pages.
I use Ant for that with a standard script found on the Jakarta website.
But it seems not to work.
what's wrong, here's my script :
****************************************
<project name="tomcat precompile" default="dist" basedir=".">
<property name="tomcat.home" location="${tomcat.home}"/>
<property name="webapp.name" value="${webapp.name}" />
<property name="webapp.path" location="${tomcat.home}/webapps/${webapp.name}"/>
<target name="jspc">
<taskdef classname="org.apache.jasper.JspC" name="jasper2" >
<classpath id="jspc.classpath">
<pathelement location="/usr/local/j2sdk1.4.2_04/lib/tools.jar"/>
<fileset dir="${tomcat.home}/server/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/common/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<taskdef name="foreach"
classname="net.sf.antcontrib.logic.ForEach"
classpath="/usr/share/ant/lib/ant-contrib-0.4.jar" />
<jasper2
validateXml="false"
uriroot="${webapp.path}"
webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
outputDir="${webapp.path}/WEB-INF/src"
package="org.apache.jsp">
</jasper2>
<replaceregexp match="^package org.apache.jsp.*;"
replace="package org.apache.jsp;"
byline="true">
<fileset dir="${webapp.path}/WEB-INF/src">
<include name="**/*.*"/>
</fileset>
</replaceregexp>
<echo>Compiling generated classes from JSPC</echo>
<foreach target="do-jsp-compile" param="dir-path">
<path>
<dirset dir="${webapp.path}/WEB-INF/src"/>
</path>
</foreach>
<move todir="${tomcat.home}/work/Standalone/localhost/${webapp.name}">
<fileset dir="${webapp.path}/WEB-INF/src">
<include name="**/*.*"/>
</fileset>
</move>
</target>
<target name="do-jsp-compile">
<echo>Compile JSP in: ${dir-path}</echo>
<javac destdir="${dir-path}"
optimize="off"
debug="on"
failonerror="false"
srcdir="${dir-path}"
>
<classpath>
<pathelement location="${webapp.path}/WEB-INF/classes"/>
<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>
</classpath>
<include name="*.java" />
</javac>
<mkdir dir="${dir-path}/org/apache/jsp"/>
<move todir="${dir-path}" failonerror="false">
<fileset dir="${dir-path}/org/apache/jsp">
<include name="*.*"/>
</fileset>
</move>
<delete dir="${dir-path}/org" failonerror="false"/>
</target>
<target name="dist" depends="jspc" >
</target>
</project>
****************************************
----------=[ pvollenweider at jahia dot com ]=------------- Jahia : The Open Java CMS and Corporate Portal Solution www.jahia.org Community and product web site www.jahia.com Commercial services company
