將一個簡單的類(Sample)進行編譯
源文件
java源文件
package powerwind;
import javax
public class Sample {
public static void main(String[] args) throws Exception {
if (args
JOptionPane
else
JOptionPane
}
}
ant文件
注意
<?xml version=
<!
<!
<!
<project name=
<description>用於學習的簡單ant工程文件</description>
<!
<property environment=
<property file=
<property name=
<property name=
<property name=
<property name=
<property name=
<!
<path id=
<fileset dir=
<include name=
</fileset>
</path>
<!
<path id=
<path refid=
<pathelement location=
</path>
<!
<patternset id=
<exclude name=
</patternset>
<!
<target name=
<mkdir dir=
<mkdir dir=
<copy todir=
<fileset dir=
<patternset refid=
</fileset>
</copy>
</target>
<!
<target name=
<delete dir=
<delete dir=
<echo level=
</target>
<!
<target name=
<javac srcdir=
<classpath refid=
</javac>
</target>
<!
<target name=
<jar jarfile=
<fileset dir=
</jar>
</target>
<!
<target name=
<java jar=
</target>
<!
<target name=
<java classname=
<classpath refid=
<arg line=
</java>
</target>
</project>
屬性文件
manifest
jar
列表文件
Main
文件結構
E:\JAVA\SAMPLE
│ build
│ build
│
└─src
│ manifest
│
└─powerwind
Sample
可以不事先創建manifest
<!
<target name=
<manifest file=
<attribute name=
<attribute name=
</manifest>
</target>
<!
<target name=
同樣
但是
props
<properties>
<manifest>
<file>manifest
</manifest>
<jar>
<file>sample
</jar>
</properties>
這樣
當然
操作說明
切換到目錄E:\java\sample>
如果輸入 ant –projecthelp 會得到各個任務的描述
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28410.html