Ant是Java平台下非常棒的批處理命令執行程序
Eclipse中已經集成了Ant
以前面建立的Hello工程為例
新建一個build
通常
然後在根目錄下創建build
<?xml version=
<project name=
<!
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<!
<path id=
<fileset file=
<pathelement path=
</path>
<!
<target name=
</target>
<!
<target name=
<mkdir dir=
<javac srcdir=
<classpath refid=
</javac>
</target>
<!
<target name=
<mkdir dir=
<junit printsummary=
haltonfailure=
failureproperty=
showoutput=
<classpath refid=
<formatter type=
<batchtest todir=
<fileset dir=
<include name=
</fileset>
</batchtest>
</junit>
<fail if=
***********************************************************
**** One or more tests failed! Check the output
***********************************************************
</fail>
</target>
<!
<target name=
<mkdir dir=
<jar destfile=
<exclude name=
<exclude name=
</jar>
</target>
<!
<target name=
<mkdir dir=
<javadoc destdir=
author=
version=
use=
windowtitle=
<packageset dir=
<include name=
</packageset>
<doctitle><![CDATA[<h
<bottom><![CDATA[<i>All Rights Reserved
<tag name=
</javadoc>
</target>
</project>
以上xml依次定義了init(初始化)
選中Hello工程
填入Name
然後在Builder面板中鉤上Ant_Build
再次編譯
Buildfile: F:\eclipse
init:
compile:
[mkdir] Created dir: F:\eclipse
[javac] Compiling
test:
[mkdir] Created dir: F:\eclipse
[junit] Running example
[junit] Tests run:
pack:
[mkdir] Created dir: F:\eclipse
[jar] Building jar: F:\eclipse
doc:
[mkdir] Created dir: F:\eclipse
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source files for package example
[javadoc] Constructing Javadoc information
[javadoc] Standard Doclet version
[javadoc] Building tree for all the packages and classes
[javadoc] Building index for all the packages and classes
[javadoc] Building index for all classes
[javadoc] Generating F:\eclipse
[javadoc] Note: Custom tags that could override future standard tags: @todo
[javadoc] Note: Custom tags that were not seen: @todo
BUILD SUCCESSFUL
Total time:
Ant依次執行初始化
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28185.html