100分问一个关于ant时build.xml的问题
大河V5 2005-08-05 11:09:48 我的build.xml文件为
<project name="test" default="buildwar" basedir=".">
<!--Load The Build Properties File-->
<property file="build.properties"/>
<property name="app.name" value="app"/>
<property name="lib.root.path" value="lib"/>
<property name="src.root.path" value="src"/>
<property name="webcontext.root.path" value="web"/>
<property name="configs.root.path" value="configs"/>
<!--Define The Classpath-->
<path id="classpath">
<fileset dir="${lib.root.path}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="clean">
<delete dir="${build.root.path}"/>
</target>
<target name="prepare" depends="clean">
<mkdir dir="${build.root.path}"/>
</target>
<target name="compile" depends="prepare">
<!--1. Compile Java Source Files-->
<javac srcdir="${src.root.path}" destdir="${webcontext.root.path}/WEB-INF/classes" debug="true">
<classpath refid="classpath"/>
</javac>
<!--2. Convert Properties Files-->
<native2ascii
encoding="GB2312"
src="${src.root.path}"
dest="${webcontext.root.path}/WEB-INF/classes"
includes="**/*_zh_ascii.properties **/*_ja_ascii.properties"/>
<!--3. Copy Other Required Files-->
<copy todir="${webcontext.root.path}/WEB-INF/classes">
<fileset dir="${src.root.path}"
includes="**/*.properties **/*.png **/*.gif **/*.jpg **/*.psd **/*.xml **/*.html **/*.htm **/*.dtd **/*.css **/*.jsp **/*.js **/*.tld"/>
</copy>
</target>
<target name="buildwar" depends="compile">
<copy todir="${build.root.path}">
<fileset dir="${webcontext.root.path}"/>
</copy>
<jar jarfile="${build.root.path}/${app.name}.war" basedir="${build.root.path}"/>
</target>
<target name="deploy" depends="buildwar">
<copy todir="${src.root.path}" file="${build.root.path}/${app.name}.war"/>
</target>
</project>
build.properties文件如下:
build.root.path = build
deploy.path = C:/Tomcat4.1/webapps
为什么我ant的时候,最后一句不执行?就是下面deploy这句。
<target name="deploy" depends="buildwar">
<copy todir="${src.root.path}" file="${build.root.path}/${app.name}.war"/>
</target>