这套脚本目前是公司这边在用的,先记录在博客,备忘~
==========build.xml=============
<project name="Webapp Precompilation" default="all" basedir=".">
<property file="build.properties"/>
<!-- 编译jsp文件 -->
<target name="jspc">
<taskdef classname="org.apache.jasper.JspC" name="jasper2">
<classpath id="jspc.classpath">
<!-- 设定工程依赖的jar包 -->
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="${tomcat.home}/bin">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<jasper2
javaEncoding="utf-8"
validateXml="false" verbose="9"
uriroot="${webapp.path}"
outputDir="${webapp.path}/WEB-INF/src"
webXmlFragment="${webapp.path}/WEB-INF/generated2-web.xml" />
</target>
<target name="compile">
<mkdir dir="${webapp.path}/WEB-INF/classes"/>
<mkdir dir="${webapp.path}/WEB-INF/lib"/>
<javac destdir="${webapp.path}/WEB-INF/classes"
optimize="of"
encoding="utf-8"
debug="on" failonerror="false"
srcdir="${webapp.path}/WEB-INF/src"
excludes="**/*.smap">
<classpath>
<pathelement location="${webapp.path}/WEB-INF/classes"/>
<fileset dir="${webapp.path}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/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>
<jar jarfile="${webapp.path}/WEB-INF/lib/cadre.jar" basedir="${webapp.path}/WEB-INF/classes"/>
</target>
<target name="all" depends="jspc,compile"></target>
</project>
=========build.properties============
tomcat.home=D:/tools/apache-tomcat-7.0.47/
webapp.path=E:/Nemo_work04/sms/WebContent/
src.path =E:/Nemo_work04/sms/src/