Ant Project
16 February 2008In this post, I will present a sample build.xml file for a simple Java “Hello, world” application and will explain the ANT project.
<project name="HelloWorld" default="compile"> <target name="compile"> <javac srcdir = "." /> </target> <target name = "run" depends = "jar"> <java classname = "HelloWorld" classpath = "HelloWorld.jar" fork = "true" /> </target> </project>
Please refer to the code above. You know that the Ant’s buildfiles are written in XML. Each buildfile contains one project and at least one default target. Targets in turn contain task elements. Each task element of the buildfile can have an id attribute and can later be referred to by the value supplied to this. This value has to be unique.
Project
A project is the top level element in an Ant script. It has three optional attributes:
name - is the name of the project
default - is the default target to use when no target is supplied
basedir - is the base directory from which all path calculations are done
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Ant Project