???????и?build.xml???????????£?

 

Buildfile: Z:vAccess_myeclipseTestAntuild.xml
clean:
compile:
[mkdir] Created dir: Z:vAccess_myeclipseTestAntuildclasses
[javac] Z:vAccess_myeclipseTestAntuild.xml:9: warning: 'includeantruntime' was not set?? defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to Z:vAccess_myeclipseTestAntuildclasses
BUILD SUCCESSFUL
Total time: 2 seconds

????2.???Ant??java????????Java????
????Ant?п??????java???????????Java???????????????1???????н??????μ??????????build.xml????????????£?

 

<?xml version="1.0"?>
<project name="javaTest" default="run" basedir=".">
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile" depends="clean">
<mkdir dir="build/classes"/>
<javac srcdir="src" destdir="build/classes"/>
</target>
<target name="run" depends="compile">
<java classname="com.ant.test01.Test01">
<classpath>
<pathelement path="build/classes"/>
</classpath>
</java>
</target>
</project>

????????????????????????
????...
????[java] Hello??Amigo
????...
????3. ???Ant??war??????J2EE Web???
?????????????????£?

 

<?xml version="1.0"?>
<project name="antwebproject" default="war" basedir=".">
<property name="classes" value="build/classes" />
<property name="build" value="build" />
<property name="lib" value="WebRoot/WEB-INF/lib" />
<!-- ???build·??-->
<target name="clean">
<delete dir="build" />
</target>
<!-- ????build/classes·??????????class?????build/classes·????-->
<target name="compile" depends="clean">
<mkdir dir="${classes}" />
<javac srcdir="src" destdir="${classes}" />
</target>
<!-- ??war??-->
<target name="war" depends="compile">
<war destfile="${build}/TestAnt.war" webxml="WebRoot/WEB-INF/web.xml">
<!-- ????WebRoot?3???WEB-INF??META-INF???????????-->
<fileset dir="WebRoot" includes="**/*.jsp" />
<!-- ????lib???μ?jar??-->
<lib dir="${lib}" />
<!-- ????build/classes?μ?class???-->
<classes dir="${classes}" />
</war>
</target>
</project>