<project name="jspToServletToClass" default="jsp2servlet2class" basedir="."> <!-- set global properties for this build --> <property environment="env" /> <property name="src" location="F:/JspC/src/" /> <property name="build" location="F:/JspC/classes" /> <property name="dist" location="dist" /> <property name="webapp.name" value="arms" /> <property name="tomcat.home" value="D:/Java/apache-tomcat-5.5.28" /> <property name="webapp.path" value="../../webapp" /> <property name="jspoutput.path" value="${tomcat.home}/work/Catalina/localhost/${webapp.name}/" /> <property name="tomcat.lib.server" value="." /> <property name="tomcat.lib.common" value="." /> <property name="tomcat.lib.lib" value="." /> <available property="tomcat.lib.server" file="${tomcat.home}/server/lib" type="dir" value="${tomcat.home}/server/lib" /> <available property="tomcat.lib.common" file="${tomcat.home}/common/lib" type="dir" value="${tomcat.home}/common/lib"/> <available property="tomcat.lib.lib" file="${tomcat.home}/lib" type="dir" value="${tomcat.home}/lib"/> <target name="init"> <!-- Create the time stamp --> <tstamp /> <!-- Create the build directory structure used by compile --> <mkdir dir="${build}" /> </target> <target name="initTomcatPath"> </target> <target name="jsp2servlet2class" depends="jsp2java,compileJspServlet" /> <target name="jsp2java"> <echo> ${tomcat.lib.server} ${tomcat.lib.common} ${tomcat.lib.lib} </echo> <taskdef classname="org.apache.jasper.JspC" name="jsp2java"> <classpath id="jsp2java.classpath"> <fileset dir="${tomcat.home}/bin"> <include name="*.jar" /> </fileset> <fileset dir="${tomcat.lib.server}"> <include name="*.jar" /> </fileset> <fileset dir="${tomcat.lib.common}"> <include name="*.jar" /> </fileset> <fileset dir="${tomcat.lib.lib}"> <include name="*.jar" /> </fileset> </classpath> </taskdef> <jsp2java classpath="jsp2java.classpath" javaEncoding="UTF-8" validateXml="false" uriroot="${webapp.path}" webXmlFragment="${webapp.path}/WEB-INF/webJSP.xml" outputDir="${jspoutput.path}" /> </target> <target name="compileJspServlet" description="compile the source "> <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${jspoutput.path}" destdir="${jspoutput.path}" failοnerrοr="false" verbose="true" debug="on"> <classpath id="java2class.classpath"> <pathelement location="${tomcat.home}/webapps/${webapp.path}/WEB-INF/classes" /> <pathelement location="${webapp.path}/WEB-INF/classes" /> <fileset dir="${webapp.path}/WEB-INF/lib"> <include name="*.jar" /> </fileset> <fileset dir="${tomcat.lib.server}"> <include name="*.jar" /> </fileset> <fileset dir="${tomcat.lib.common}"> <include name="*.jar" /> </fileset> <fileset dir="${tomcat.lib.lib}"> <include name="*.jar" /> </fileset> <fileset dir="${tomcat.home}/bin"> <include name="*.jar" /> </fileset> </classpath> </javac> </target> <target name="compile" depends="init" description="compile the source "> <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${src}" destdir="${build}" failοnerrοr="false" verbose="false" debug="false" /> </target> <target name="dist" depends="compile" description="generate the distribution"> <!-- Create the distribution directory --> <mkdir dir="${dist}/lib" /> <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}" /> </target> <target name="clean" description="clean up"> <!-- Delete the ${build} and ${dist} directory trees --> <delete dir="${build}" /> <delete dir="${dist}" /> </target> </project>