建立工程资源文件buildproperties
文件内容是下面一行内容
classpath=build\\classes
建立java源文件helloantHelloAntjava
package helloant;
public class HelloAnt {
public static void main(String[] args) {
Systemoutprintln(hello ant the first time using ant it is great);
}
}
编译
C:\workspace\anttest>ant buildfile buildxml
Buildfile: buildxml
[echo] pulling in property files
init:
[echo] init delete the old class files and create the new folds
[delete] Deleting directory C:\workspace\anttest\build\classes
[mkdir] Created dir: C:\workspace\anttest\build\classes
compile:
[echo] compile the java source files
[javac] Compiling source file to C:\workspace\anttest\build\classes
main:
[echo] calling java to run this java project
[java] hello ant the first time using ant it is great
BUILD SUCCESSFUL
Total time: milliseconds
C:\workspace\anttest>
[] [] []