by Michael Thomas
On the ANT Home page, you can download the whole ANT site (all content, tutorials & examples) !!!
| Topic | Info |
| Directory Structure | Directories
|
| Main Example Files | tutorial_firststeps_jar - list of
files
|
| tutorial_firststeps_jar tutorial_firststeps_jar\src tutorial_firststeps_jar\src\firststeps |
| Filename: tutorial_firststeps_jar\src\firststeps\HelloWorld1.java |
package firststeps;
public class HelloWorld1 {
public static void main(String[] args) {
System.out.println("Hello World #1");
}
}
|
| Filename: tutorial_firststeps_jar\src\firststeps\HelloWorld1.java |
package firststeps;
public class HelloWorld2 {
public static void main(String[] args) {
System.out.println("Hello World #2");
}
}
|
| HelloWorld_build_ant.xml |
| HelloWorld_build_ant.xml
- click here to view the contents so you can view the contents and
cut-n-paste if needed. Here is a repeat of the contents of the
file for your viewing, but I suggest clicking the link above! |
clean Deletes directories that the build will create. compile Compiles all .java files. jar Creates the JAR file with a Main-Class. run Runs the main-class in the JAR file. clean-build Could clean up!
| HelloWorld_build_ant.bat |
call ant -buildfile HelloWorld_build_ant.xml -projecthelp call ant -buildfile HelloWorld_build_ant.xml pause |
ant -buildfile HelloWorld_build_ant.xml -projecthelp
Buildfile: HelloWorld_build_ant.xml
Main targets:
Other targets:
clean
clean-build
compile
jar
main
run
Default target: main
Buildfile: HelloWorld_build_ant.xml
clean:
[delete] Deleting directory C:\_data\webs\A\michael-thomas.com\tech\apache\an
t\tutorial_firststeps_ant\build
compile:
[mkdir] Created dir: C:\_data\webs\A\michael-thomas.com\tech\apache\ant\tuto
rial_firststeps_ant\build\classes
[javac] Compiling 2 source files to C:\_data\webs\A\michael-thomas.com\tech\
apache\ant\tutorial_firststeps_ant\build\classes
jar:
[mkdir] Created dir: C:\_data\webs\A\michael-thomas.com\tech\apache\ant\tuto
rial_firststeps_ant\build\jar
[jar] Building jar: C:\_data\webs\A\michael-thomas.com\tech\apache\ant\tut
orial_firststeps_ant\build\jar\HelloWorld.jar
run:
[java] Hello World #1
main:
BUILD SUCCESSFUL
Total time: 1 second
Press any key to continue . . . |
| HelloWorld_build_ant_run_jar.bat |
call _setpathjdk.bat rem Run the class defined in the manifest file created during the Jar build. java -jar build\jar\HelloWorld.jar pause |
| HelloWorld_build_ant_buildoptions.bat |
call ant -buildfile HelloWorld_build_ant.xml -projecthelp rem call ant -buildfile HelloWorld_build_ant.xml clean rem call ant -buildfile HelloWorld_build_ant.xml clean compile rem call ant -buildfile HelloWorld_build_ant.xml clean compile jar rem call ant -buildfile HelloWorld_build_ant.xml clean compile jar run rem call ant -buildfile HelloWorld_build_ant.xml run rem ******** Run all of the targets in the build file ******* call ant -buildfile HelloWorld_build_ant.xml pause |