ant学习(1)

路径:/home/framework_Study/springinAction/webRoot/WEB-INF

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 
 3 <project name="springTrain" basedir="."> //基本路径为当前所在路径,设置为其它值的作用暂时不明白
 4 
 5 <property environment="env"/>//获取当前系统的环境变量
 6 <property name="src" value="src"/>
 7 <property name="src_job" value="src/com/gc"/>
 8 <property name="classes" value="classes"/>
 9 
10 <path id="compile.classpath"> //定义path 编译环境变量
11   <fileset dir="${env.JAVA_HOME}/lib">
12     <include name="tools.jar"/>
13   </fileset>
14   <fileset dir="lib">
15     <include name="*.jar"/>
16   </fileset>
17 </path>
18 
19 <path id="run.classpath"> //运行环境变量
20   <path refid="compile.classpath"/>
21   <pathelement location="${src}"/>
22 </path>
23 
24 <target name="initcompile"> //初始化编译
25 <javac destdir="${src}" debug="true" failonerror="true" includeAntRuntime="true">
26 <src path="${src}"/>
27 <classpath refid="compile.classpath"/>
28 </javac>
29 </target>
30 
31 <target name="compile"> //编译
32 <javac destdir="${src}" debug="true" failonerror="true" includeAntRuntime="false">
33 <src path="${src_job}"/>
34 <classpath refid="compile.classpath"/>
35 </javac>
36 </target>
37 
38 <target name="run"> //运行
39 <java classname="com.gc.test.TestHelloWorld" fork="true" failonerror="true">
40 <classpath refid="run.classpath"/>
41 </java>
42 </target>
43 
44 <target name="clean"> //清理,删除文件
  <delete includeemptydirs="true">
  <fileset dir="${deletetest}">
  <include name="**/*.java"/>
  <include name="**/*.xml"/>
  </fileset>
  </delete> 45 </target> 46 47 <target name="initcopy"> //初始化复制 48 <copy todir="${classes}" overwrite="true"> 49 <fileset dir="${src}" excludes="**/*.java"/> 50 </copy> 51 </target> 52 53 <target name="copy"> //复制 54 <copy todir="${classes}" overwrite="true"> 55 <fileset dir="${src_job}" excludes="**/*.java"/> 56 </copy> 57 </target> 58 59 </project>

 

posted @ 2016-04-05 16:46  马丁的早晨  阅读(110)  评论(0编辑  收藏  举报