Ant的基本build.xml实例

<?xml version="1.0" encoding="UTF-8"?>

<project name="Test" default="all" basedir=".">

<property file="${basedir}/classpath.properties" />

<!-- build -->
<target name="all" >
	<antcall target="compile1"/>
	<antcall target="jar1" />
	<antcall target="copy1" />
	<antcall target="compile2" />
	<antcall target="war2" />
</target>

<!-- compile1 -->
<target name="compile1">
	<mkdir dir="${basedir}/comm/bin" />
	<javac srcdir="${basedir}/comm/src" destdir="${basedir}/comm/bin" classpath="${classpath_comm}" />
</target>

<!-- jar1 -->
<target name="jar1">
	<mkdir dir="${basedir}/comm/jar" />
	<jar destfile="${basedir}/comm/jar/comm.jar" >
		<fileset dir="${basedir}/comm/bin" />
	</jar>
</target>

<!-- copy1 -->
<target name="copy1">
    <copy file="${basedir}/comm/jar/comm.jar" todir="${basedir}/ApiWeb/WebContent/WEB-INF/lib"/>
</target>

<!-- compile2 -->
<target name="compile2">
    <mkdir dir="${basedir}/ApiWeb/WebContent/WEB-INF/classes" />
    <javac srcdir="${basedir}/ApiWeb/src" destdir="${basedir}/ApiWeb/WebContent/WEB-INF/classes" classpath="${classpath_ApiWeb}"/>
</target>

<!-- war2 -->
<target name="war2">
	<jar basedir="${basedir}/ApiWeb/WebContent" jarfile="${basedir}/ApiWeb/ApiWeb.war" />
</target>

</project>

 

你可能感兴趣的:(build.xml)