ANT (Example) - 1

18 May 2008

This post is all about an ANT example. I will present an ANT build script that will compile a project, and will generate a JAR file.

I will name the project as Project X and will provide some useful description.

<?xml version="1.0"?>
<project default="dist" name="Project X">
<description>Test project</description>

Now is the time to define the properties. Properties are like variable we use in Java or C++.

<property name="srcDir" location="src"/>
<property name="buildDir" location="build"/>
<property name="distDir" location="dist"/>

I defined 3 properties. First one contains the path of source directory, second one contains the path of build directory (where class files will be generated), and the third one contains the path of distribution directory, which will actually contain the JAR file.

Now, lets define the targets. First target is init, which simply creates 2 directories using ANT built in commands.

<target name="init">
<tstamp/>
<mkdir dir="${buildDir}"/>
<mkdir dir="${distDir}"/>
</target>

Continued …

Related Posts:

  • No related posts
del.icio.us:ANT (Example) - 1  digg:ANT (Example) - 1  spurl:ANT (Example) - 1  wists:ANT (Example) - 1  simpy:ANT (Example) - 1  newsvine:ANT (Example) - 1  blinklist:ANT (Example) - 1  furl:ANT (Example) - 1  reddit:ANT (Example) - 1  fark:ANT (Example) - 1  blogmarks:ANT (Example) - 1  Y!:ANT (Example) - 1  smarking:ANT (Example) - 1  magnolia:ANT (Example) - 1  segnalo:ANT (Example) - 1  gifttagging:ANT (Example) - 1

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 (Example) - 1

Leave a Reply