Ant Project

16 February 2008

In 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

del.icio.us:Ant Project  digg:Ant Project  spurl:Ant Project  wists:Ant Project  simpy:Ant Project  newsvine:Ant Project  blinklist:Ant Project  furl:Ant Project  reddit:Ant Project  fark:Ant Project  blogmarks:Ant Project  Y!:Ant Project  smarking:Ant Project  magnolia:Ant Project  segnalo:Ant Project  gifttagging:Ant Project

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

Leave a Reply