<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nimal&#039;s Weblog &#187; Ant</title>
	<atom:link href="http://nimal.info/blog/tag/ant/feed/" rel="self" type="application/rss+xml" />
	<link>http://nimal.info/blog</link>
	<description>Nimal blogs here</description>
	<lastBuildDate>Tue, 24 Apr 2012 12:00:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Luntbuild : Introduction</title>
		<link>http://nimal.info/blog/2008/luntbuild-introduction/</link>
		<comments>http://nimal.info/blog/2008/luntbuild-introduction/#comments</comments>
		<pubDate>Tue, 06 May 2008 18:02:00 +0000</pubDate>
		<dc:creator>Nimal</dc:creator>
				<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Luntbuild]]></category>

		<guid isPermaLink="false">http://nimal.info/blog/?p=75</guid>
		<description><![CDATA[<p>This is going to be another short series (2-3 posts) about a build automation tool. I got using this during my internship at WaveNET. I don&#8217;t this this is going to be a very useful post to many ( I &#8230; <a href="http://nimal.info/blog/2008/luntbuild-introduction/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://nimal.info/blog/2008/luntbuild-introduction/">Luntbuild : Introduction</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></description>
			<content:encoded><![CDATA[<p>This is going to be another short series (2-3 posts) about a build automation tool. I got using this during my internship at WaveNET. I don&#8217;t this this is going to be a very useful post to many <i>( I here some one saying when I write useful posts </i> <img src='http://nimal.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <i> )</i>, but it could be at least a reference for some one out there or to me some day.<br />
<h4>Introduction</h4>
<p> Luntbuild is a powerful build automation and management tool. Continuous Integration or nightly builds can be easily set using a clean web interface. Executed builds are well managed using functions such as search, categorization, promotion, patching, deletion, etc. It also acts as a central build artifacts repository and download area for your whole team. </p>
<h4>Why Luntbuild?</h4>
<p>You may ask why Luntbuild, while there are already many good build automation tools such as Cruise Control, Anthill, and others. Our answer is: </p>
<ul>
<li>Luntbuild aims at not only being build automation, but also build management system. Executed builds can be categorized, promoted, searched, patched, deleted, etc. This is very important for a nightly builds or Continuous Integration builds, which generate many builds over time. </li>
<li>Luntbuild utilizes the project/schedule concept to easily provide build support for parallel development. </li>
<li>No configuration files, all jobs are done using web interface. You can set your Luntbuild system in less than thirty minutes.</li>
</ul>
<p> Luntbuild makes advantage of quite a few open source libraries and frameworks listed here.</p>
<p>Luntbuild homepage <a href="http://luntbuild.javaforge.com/" target="_blank"><span>http://luntbuild.javaforge.com/</span></a> </p>
<h4>What Luntbuild does?</h4>
<p>Basic unit of work in Luntbuild is a build. Build execution is triggered either by a schedule or it can be started manually. A build in Luntbuild performs following steps: </p>
<ol>
<li>Checks out source code from the Version Control System(s) (VCS). </li>
<li>Labels the current source code based on the current build version. </li>
<li>Runs an Ant/Maven/Command/Rake build script in the source tree. </li>
<li>Runs an Ant/Maven/Command/Rake post build script in the source tree. </li>
<li>Publishes the build log and other build artifacts. </li>
</ol>
<p>Build configuration, monitoring, and access to the build artifacts are all done using an intuitive web interface. Development and testing teams will have a central area to access the build information.</p>
<p>We shall see basic installation steps in the next post.</p>
<p><a href="http://nimal.info/blog/2008/luntbuild-introduction/">Luntbuild : Introduction</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></content:encoded>
			<wfw:commentRss>http://nimal.info/blog/2008/luntbuild-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ant: Simple JUnit Test</title>
		<link>http://nimal.info/blog/2008/ant-simple-junit-test/</link>
		<comments>http://nimal.info/blog/2008/ant-simple-junit-test/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 21:30:00 +0000</pubDate>
		<dc:creator>Nimal</dc:creator>
				<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[JUnit]]></category>

		<guid isPermaLink="false">http://nimal.info/blog/?p=67</guid>
		<description><![CDATA[<p>This is the final part of the so called Ant series I have been writing in this blog, about Apache Ant. This is an extremely brief tutorial on JUnit. The goal is to test Ant and JUnit framework integration . &#8230; <a href="http://nimal.info/blog/2008/ant-simple-junit-test/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://nimal.info/blog/2008/ant-simple-junit-test/">Ant: Simple JUnit Test</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></description>
			<content:encoded><![CDATA[<div>
<div>
<p>This is the <i>final </i>part of the <i>so called Ant series</i> I have been writing in this blog, about Apache Ant. This is an extremely brief tutorial on JUnit. The goal is to test Ant and JUnit framework integration .</p>
<p>The previous posts on Ant can be found here:</p>
<ol>
<li><a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html" target="_blank">Apache Ant</a></li>
<li><a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-installation.html" target="_blank">Ant: Installation</a></li>
<li><a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html" target="_blank">Ant: Hello World in Ant</a></li>
<li><span><a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-java-hello-world-in-ant.html" target="_blank">Ant: Java Hello World in Ant</a></span></li>
<li><span><a href="http://thetalkouttrojans.blogspot.com/2008/03/ant-java-swing-hello-world-in-ant.html" target="_blank">Ant: Java Swing Hello World in Ant</a><br />  </span></li>
</ol>
<h3>Prerequisites</h3>
<p>In order to do this we will need to have a <a href="http://www.java.com/" target="_blank"><span>Java compiler</span></a>, <a href="http://ant.apache.org/" target="_blank"><span>Ant</span></a>, and <a href="http://junit.org/" target="_blank"><span>JUnit</span></a> installed. </p>
<h3>Java Classes<br /></h3>
<p>First, we need a Java class to test. I had to make this example too simple according to my Java knowledge. This lacks any Java Docs or comments, but it&#39;s a pretty simple bit of code. <img src='http://nimal.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<pre>public class Math {	static public int add(int a, int b) {		return a + b;	}

	static public int multiply ( int a, int b) {		return a * b;	}}</pre>
<p> Then to test this code, we need a second Java class that will </p>
<ol>
<li>import junit.framework.* </li>
<li>extend TestCase </li>
</ol>
<p> There are two important points to note in the sample. First, the routine is named <i>testAdd</i>. This convention tells that the routine is supposed to be a test and that it&#39;s targeting the <i>add</i> functionality. Here&#39;s the matching example. </p>
<pre>import junit.framework.*;

public class TestMath extends TestCase { 

  protected void setUp() {   	// put common setup code in here  }

  protected void tearDown() {  	// put common cleanup code in here

  }

  public void testAdd() {  	int num1 = 3;  	int num2 = 2;  	int total = 5;  	int sum = 0;  	sum = Math.add(num1, num2);  	assertEquals(sum, total);  }

  public void testMulitply() {

  	int num1 = 3;   	int num2 = 7;   	int total = 21;  	int sum = 0;  	sum = Math.multiply(num1, num2);  	assertEquals(&quot;Problem with multiply&quot;, sum, total);

  	num1 = 5;   	num2 = 4;

  	total = 20;  	sum = Math.multiply(num1, num2);  	assertEquals(&quot;Problem with multiply&quot;, sum, total);  }}</pre>
<p> And both these files could be kept in a sub-folder named <i>src</i> </p>
<h3>Ant Script<br /></h3>
<p>The last step is how to run your JUnit tests using Ant. Create a file called <i>build.xml</i> and place it in the main folder. The core of this scripts is the following, which does the JUnit tests. </p>
<pre>&lt;junit printsummary=&quot;yes&quot; haltonfailure=&quot;yes&quot; showoutput=&quot;yes&quot; &gt;	&lt;classpath&gt;		&lt;pathelement path=&quot;${build}&quot;/&gt;		&lt;fileset dir=&quot;lib&quot;&gt;

			&lt;include name=&quot;**/*.jar&quot;/&gt;		&lt;/fileset&gt;	&lt;/classpath&gt; 	&lt;batchtest fork=&quot;yes&quot; todir=&quot;${reports}/raw/&quot;&gt;		&lt;formatter type=&quot;xml&quot;/&gt; 		&lt;fileset dir=&quot;${src}&quot;&gt;

			&lt;include name=&quot;**/*Test*.java&quot;/&gt;		&lt;/fileset&gt;	&lt;/batchtest&gt;&lt;/junit&gt;</pre>
<p> The file I used is <i><a href="http://talkout.googlepages.com/build.xml" title="Attachment Ant/SimpleJUnitTest: build.xml" target="_blank">this one</a></i>. (The inner details of this scripts are Ant Scripting and XML, which is not explained in this document, but really straightforward to understand) </p>
<h3>Output</h3>
<p>Run <i>ant test</i> in command line: </p>
<pre>[root@nimal junit-sample]# ant testBuildfile: build.xml

init:

compile:    [javac] Compiling 2 source files to /opt/junit-sample/bin

run-tests:    [junit] Running TestMath

    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.321 sec

test:[junitreport] Processing /opt/junit-sample/reports/TESTS-TestSuites.xml to /tmp/null1227203872[junitreport] Loading stylesheet jar:file:/usr/local/ant/lib/ant-junit.jar!/org/apache/tools/ant

 /taskdefs/optional/junit/xsl/junit-frames.xsl[junitreport] Transform time: 1714ms[junitreport] Deleting: /tmp/null1227203872

BUILD SUCCESSFULTotal time: 6 seconds</pre>
<p>Ant will also do nice things like create nice HTML reports! I&#39;ve linked to a simple Ant script that will compile all the code in your &quot;src&quot; folder, run all the tests named &quot;test*&quot; and then create an HTML report in your &quot;reports\html&quot; folder. </p>
<p> I&#39;ve linked to a zip file (<a href="http://talkout.googlepages.com/ant-junit-sample.zip" target="_blank">ant-junit-sample.zip</a>) that contains the build.xml file, the source code and the test class. (If you try to run it and get errors about JUnit not being found, remember to add that <i>junit.jar</i> to your Ant lib folder.) </p>
</p></div>
</p></div>
<h3>Attachments</h3>
<ul>
<li><a href="http://talkout.googlepages.com/ant-junit-sample.zip" target="_blank">ant-junit-sample.zip</a> (109.6 kB) -<q>Scripts for Test </q>,</li>
<li><a href="http://talkout.googlepages.com/build.xml" target="_blank">build.xml</a> (2.7 kB) -<q>Ant+JUnit build script </q>, </li>
</ul>
<p><a href="http://talkout.googlepages.com/ant-junit-sample.zip" target="_blank"></a><br clear="all"/><a href="http://talkout.googlepages.com/build.xml" target="_blank"></a></p>
<p><a href="http://nimal.info/blog/2008/ant-simple-junit-test/">Ant: Simple JUnit Test</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></content:encoded>
			<wfw:commentRss>http://nimal.info/blog/2008/ant-simple-junit-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ant: Java Swing Hello World in Ant</title>
		<link>http://nimal.info/blog/2008/ant-java-swing-hello-world-in-ant/</link>
		<comments>http://nimal.info/blog/2008/ant-java-swing-hello-world-in-ant/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 08:06:00 +0000</pubDate>
		<dc:creator>Nimal</dc:creator>
				<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nimal.info/blog/?p=65</guid>
		<description><![CDATA[<p>This is the fifth part of the so called Ant series I have been writing in this blog, about Apache Ant. This post is mainly about building and running a Java Swing program using Ant. The previous posts on Ant &#8230; <a href="http://nimal.info/blog/2008/ant-java-swing-hello-world-in-ant/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://nimal.info/blog/2008/ant-java-swing-hello-world-in-ant/">Ant: Java Swing Hello World in Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></description>
			<content:encoded><![CDATA[<p>This is the fifth part of the so called Ant series I have been writing in this blog, about Apache Ant. This post is mainly about building and running a <i>Java Swing program</i> using Ant.</p>
<p>The previous posts on Ant can be found here:</p>
<p>1. <a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html">Apache Ant</a><br />2. <a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-installation.html">Ant: Installation</a><br />3. <a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html">Ant: Hello World in Ant</a><span><br />4. <a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-java-hello-world-in-ant.html">Ant: Java Hello World in Ant</a></span><br /><span style="font-weight: bold;font-size:130%;" ><br />Java Swing Program</span>
<p>Create the following simple swing program and save it as <i>HelloWorldSwing.java</i> in a sub folder <i>src</i>: </p>
<pre>import javax.swing.JFrame;import javax.swing.JLabel;

public class HelloWorldSwing {public static void main(String[] args) {JFrame frame = new JFrame("HelloWorldSwing");final JLabel label = new JLabel("Hello World");frame.getContentPane().add(label);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setVisible(true);   }}</pre>
<p><span style="font-weight: bold;font-size:130%;" >Ant Script</span>
<p>Use a text editor to create a file called <i>build.xml</i> and place it in the main folder: </p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;project name="Run Test" default="run" basedir="."&gt;

&lt;target name="clean"&gt;   &lt;delete dir="build"/&gt;&lt;/target&gt;

&lt;target name="compile" depends="clean"&gt;   &lt;mkdir dir="build/classes"/&gt;   &lt;javac srcdir="src" destdir="build/classes"/&gt;&lt;/target&gt;

&lt;target name="jar" depends="compile"&gt;   &lt;mkdir dir="build/jar"/&gt;   &lt;jar destfile="build/jar/HelloWorldSwing.jar" basedir="build/classes"&gt;       &lt;manifest&gt;           &lt;attribute name="Main-Class" value="HelloWorldSwing"/&gt;       &lt;/manifest&gt;   &lt;/jar&gt;&lt;/target&gt;

&lt;target name="run" depends="jar"&gt;   &lt;java jar="build/jar/HelloWorldSwing.jar" fork="true"/&gt;&lt;/target&gt;

&lt;/project&gt;</pre>
<p><span style="font-weight: bold;font-size:130%;" >Outputs and Problems</span>
<p>When we run this is text mode it, it compiles but fails to run. But when in GUI it runs. </p>
<pre>[root@sanjaya-vm ant-swing]# antBuildfile: build.xml

clean:[delete] Deleting directory /opt/ant-swing/build

compile:[mkdir] Created dir: /opt/ant-swing/build/classes[javac] Warning: HelloWorldSwing.java modified in the future.[javac] Compiling 1 source file to /opt/ant-swing/build/classes

jar:[mkdir] Created dir: /opt/ant-swing/build/jar[jar] Building jar: /opt/ant-swing/build/jar/HelloWorldSwing.jar

run:......[java] at java.awt.Window.&lt;init&gt;(Window.java:406)[java] at java.awt.Frame.&lt;init&gt;(Frame.java:402)[java] at javax.swing.JFrame.&lt;init&gt;(JFrame.java:207)[java] at HelloWorldSwing.main(Unknown Source)[java] Java Result: 1

BUILD SUCCESSFULTotal time: 3 seconds</pre>
<p>This is one another basic level post and I strongly advice you to refer to any more advanced document, if you are going to do this for any production system. <img src='http://nimal.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Feedback and questions are welcome via comment or you can email me at <tt>talkout AT SPAMFREE gmail DOT com</tt></p>
<p><a href="http://nimal.info/blog/2008/ant-java-swing-hello-world-in-ant/">Ant: Java Swing Hello World in Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></content:encoded>
			<wfw:commentRss>http://nimal.info/blog/2008/ant-java-swing-hello-world-in-ant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ant: Java Hello World in Ant</title>
		<link>http://nimal.info/blog/2008/ant-java-hello-world-in-ant/</link>
		<comments>http://nimal.info/blog/2008/ant-java-hello-world-in-ant/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 09:30:00 +0000</pubDate>
		<dc:creator>Nimal</dc:creator>
				<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nimal.info/blog/?p=64</guid>
		<description><![CDATA[<p>This is the third part of the so called Ant series I have been writing in this blog, about Apache Ant. This post is mainly about building and running a Java program using Ant. In the example I&#8217;m using here, &#8230; <a href="http://nimal.info/blog/2008/ant-java-hello-world-in-ant/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://nimal.info/blog/2008/ant-java-hello-world-in-ant/">Ant: Java Hello World in Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></description>
			<content:encoded><![CDATA[<p>This is the third part of the so called Ant series I have been writing in this blog, about Apache Ant. This post is mainly about building and running a Java program using Ant. In the example I&#8217;m using here, its a Hello World program in simple Java, but most of these basic Ant steps would be same for any other Java program you might run.</p>
<p>The previous posts on Ant can be found here:
<ol>
<li><a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html">Apache Ant</a></li>
<li><a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-installation.html">Ant: Installation</a></li>
<li><a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html">Ant: Hello World in Ant</a></li>
</ol>
<p><span style="font-weight: bold;font-size:130%;" >Java Program</span>
<p>Create the following simple program and save it as <i>HelloWorld.java</i> in a sub folder <i>src</i>: </p>
<pre>public class HelloWorld {public static void main(String[] args) {  System.out.println("Hello World");}}</pre>
<p><span style="font-weight: bold;font-size:130%;" >Ant Script</span>
<p>Use a text editor to create a file called <i>build.xml</i> and place it in the main folder: </p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;project name="Run Test" default="run" basedir="."&gt;

&lt;target name="clean"&gt;  &lt;delete dir="build"/&gt;&lt;/target&gt;

&lt;target name="compile" depends="clean"&gt;  &lt;mkdir dir="build/classes"/&gt;  &lt;javac srcdir="src" destdir="build/classes"/&gt;&lt;/target&gt;

&lt;target name="jar" depends="compile"&gt;  &lt;mkdir dir="build/jar"/&gt;  &lt;jar destfile="build/jar/HelloWorld.jar"          basedir="build/classes"&gt;      &lt;manifest&gt;          &lt;attribute name="Main-Class" value="HelloWorld"/&gt;      &lt;/manifest&gt;  &lt;/jar&gt;&lt;/target&gt;

&lt;target name="run" depends="jar"&gt;  &lt;java jar="build/jar/HelloWorld.jar" fork="true"/&gt;&lt;/target&gt;

&lt;/project&gt;</pre>
<p><span style="font-weight: bold;font-size:130%;" >Output</span>
<p>Run <i>ant</i> in command line: </p>
<pre>[root@nimal ant-hw]# antBuildfile: build.xml

clean:[delete] Deleting directory /opt/ant-hw/build

compile:[mkdir] Created dir: /opt/ant-hw/build/classes[javac] Warning: HelloWorld.java modified in the future.[javac] Compiling 1 source file to /opt/ant-hw/build/classes

jar:[mkdir] Created dir: /opt/ant-hw/build/jar[jar] Building jar: /opt/ant-hw/build/jar/HelloWorld.jar

run:[java] Hello WorldBUILD SUCCESSFULTotal time: 4 seconds</pre>
<p><span style="font-weight: bold;font-size:130%;" >Enhance the build file</span>
<p>Now we have a working buildfile we could do some enhancements: many time you are referencing the same directories, main-class and jar-name are hard coded, and while invocation you have to remember the right order of build steps. </p>
<pre>&lt;project name="HelloWorld" basedir="." default="main"&gt;

&lt;property name="src.dir" value="src"/&gt;&lt;property name="build.dir" value="build"/&gt;&lt;property name="classes.dir" value="${build.dir}/classes"/&gt;&lt;property name="jar.dir" value="${build.dir}/jar"/&gt;&lt;property name="main-class" value="HelloWorld"/&gt;&lt;target name="clean"&gt;  &lt;delete dir="${build.dir}"/&gt;&lt;/target&gt;

&lt;target name="compile"&gt;  &lt;mkdir dir="${classes.dir}"/&gt;  &lt;javac srcdir="${src.dir}" destdir="${classes.dir}"/&gt;&lt;/target&gt;

&lt;target name="jar" depends="compile"&gt;  &lt;mkdir dir="${jar.dir}"/&gt;   &lt;jar destfile="${jar.dir}/${ant.project.name}.jar"          basedir="${classes.dir}"&gt;      &lt;manifest&gt;          &lt;attribute name="Main-Class" value="${main-class}"/&gt;      &lt;/manifest&gt;  &lt;/jar&gt;&lt;/target&gt;

&lt;target name="run" depends="jar"&gt;  &lt;java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/&gt;&lt;/target&gt;

&lt;target name="clean-build" depends="clean,jar"/&gt;

&lt;target name="main" depends="clean,run"/&gt;

&lt;/project&gt;</pre>
<p>Feedback and questions are welcome via comment or you can email me at <tt>talkout AT SPAMFREE gmail DOT com</tt></p>
<p><a href="http://nimal.info/blog/2008/ant-java-hello-world-in-ant/">Ant: Java Hello World in Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></content:encoded>
			<wfw:commentRss>http://nimal.info/blog/2008/ant-java-hello-world-in-ant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ant: Installation</title>
		<link>http://nimal.info/blog/2008/ant-installation/</link>
		<comments>http://nimal.info/blog/2008/ant-installation/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 06:03:00 +0000</pubDate>
		<dc:creator>Nimal</dc:creator>
				<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nimal.info/blog/?p=63</guid>
		<description><![CDATA[<p>As I have worked on Ant before sometime for a project and I had few of my own documents for reference, related to installing and using Apache Ant. I thought of sharing those via this blog as it might be &#8230; <a href="http://nimal.info/blog/2008/ant-installation/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://nimal.info/blog/2008/ant-installation/">Ant: Installation</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></description>
			<content:encoded><![CDATA[<p>As I have worked on Ant before sometime for a project and I had few of my own documents for reference, related to installing and using <a href="http://en.wikipedia.org/wiki/Apache_Ant" target="_blank">Apache Ant</a>. I thought of sharing those via this blog as it might be useful to someone out there, <i>or at-least would be a backup of my doc in the Blogger servers</i>. <img src='http://nimal.info/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>In this series of Ant, I put and <i><a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html">introductory post</a></i> which is followed by a <i><a href="http://thetalkouttrojans.blogspot.com/2008/02/ant-hello-world-in-ant.html">Hello World post</a></i>, and then I got a couple of IMs asking how could one come to <i>Hello World</i> before an installation post.<i> (Seems thats the standard way of tutorial, so I said I&#8217;m not writing any tutorials, but thought of posting this now&#8230; </i> <img src='http://nimal.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8230; <i>). </i><br /><b><br /><span style="font-size:130%;">System Requirements for Ant</span></b>
<p> Ant has been used successfully on many platforms, including Linux, MacOS X, Windows XP and Unix. To build and use Ant, you must have a JAXP-compliant XML parser installed and available on your classpath, such as <a href="http://en.wikipedia.org/wiki/Xerces">Xerces</a>.</p>
<p>Note: I did this installation on a HP server running <a href="http://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux">Red Hat Enterprise Linux WS Version 4 Update 4</a>.</p>
<p>For the current version of Ant, you will also need a JDK installed on your system, version 1.2 or later required, 1.5 or later strongly recommended. The later the version of Java, the more Ant tasks you get. </p>
<p> Note: If a <a href="http://en.wikipedia.org/wiki/JDK">JDK</a> is not present, only the <a href="http://en.wikipedia.org/wiki/JRE">JRE</a> runtime, then many tasks will not work.</p>
<p><span style="font-weight: bold;font-size:130%;" >Building Ant</span></p>
<p><span style="font-weight: bold; font-style: italic;font-size:100%;" >Obtaining Ant</span>
<p> To build Ant from source, you can either install the <a href="http://ant.apache.org/srcdownload.cgi" target="_blank"><span>Ant source distribution</span></a> or checkout the Ant module from SVN. I obtained the Ant source version and placed it at <i>/opt/</i> </p>
<p> Once you have obtained the source, change into the installation directory and run, </p>
<pre>[root@nimal opt]# tar -xzvf apache-ant-1.7.0-src.tar.gz</pre>
<p>This will creat Set the JAVA_HOME environment variable to the directory where the JDK is installed. See Installing Ant for examples on how to do this for your operating system. </p>
<p> Note: The bootstrap process of Ant requires a greedy compiler like Sun&#8217;s javac or jikes. It does not work with gcj or kjc. </p>
<p>Make sure you have downloaded any auxiliary jars required to build tasks you are interested in. These should be added to the lib/optional directory of the source tree. See Library Dependencies for a list of JAR requirements for various features. Note that this will make the auxiliary JAR available for the building of Ant only. For running Ant you will still need to make the JARs available as described under Installing Ant. </p>
<p> In our case we need the <a href="http://www.junit.org/" target="_blank"><span>JUnit jar</span></a>.</p>
<p><span style="font-weight: bold; font-style: italic;font-size:100%;" >Environment Settings</span></p>
<p><span style="font-size:100%;"><i>Linux/Unix (bash)</i></span>
<p> Assume Ant is installed in /usr/local/ant. The following sets up the environment: </p>
<blockquote><p> export ANT_HOME=/usr/local/ant export JAVA_HOME=/usr/java/jdk1.6.0/ export PATH=${PATH}:${ANT_HOME}/bin </p>
</blockquote>
<p> The above can be set by editing the <i>.bashrc</i> file. </p>
<pre>[root@nimal ~]# vi ~/.</pre>
<p> Once this file is opened it will look like this. </p>
<pre># .bashrc

# User specific aliases and functions

alias rm='rm -i'alias cp='cp -i'alias mv='mv -i'

# Source global definitionsif [ -f /etc/bashrc ]; then      . /etc/bashrcfi</pre>
<p> Append these lines below the end of the if clause below <i>fi</i> </p>
<pre>export ANT_HOME=/usr/local/ant/export JAVA_HOME=/usr/java/jdk1.6.0/export PATH=${PATH}:${ANT_HOME}/bin</pre>
<p> And the final file should look like this; save and close the file. </p>
<pre># .bashrc

# User specific aliases and functions

alias rm='rm -i'alias cp='cp -i'alias mv='mv -i'

# Source global definitionsif [ -f /etc/bashrc ]; then      . /etc/bashrcfi

export ANT_HOME=/usr/local/ant/export JAVA_HOME=/usr/java/jdk1.6.0/export PATH=${PATH}:${ANT_HOME}/bin</pre>
<p><span style="font-weight: bold; font-style: italic;font-size:100%;" >Normal build and install</span>
<p> Your are now ready to build Ant: </p>
<blockquote><p> build -Ddist.dir=&lt;directory_to_contain_Ant_distribution&gt; dist    (Windows) sh build.sh -Ddist.dir=&lt;directory_to_contain_Ant_distribution&gt; dist    (Unix) </p>
</blockquote>
<pre>[root@nimal opt]# cd /opt/apache-ant-1.7.0/[root@nimal apache-ant-1.7.0]# sh build.sh -Ddist.dir=/usr/local/ant/ distBuildfile: build.xml

dist:

prepare:

check_for_optional_packages:

build:  [copy] Copying 2 files to /opt/apache-ant-1.7.0/build/classes

jars:  [jar] Building jar: /opt/apache-ant-1.7.0/build/lib/ant.jar

  .  .  .

compile-tests:

test-jar:

dist-lite: [mkdir] Created dir: /usr/local/ant [mkdir] Created dir: /usr/local/ant/bin [mkdir] Created dir: /usr/local/ant/lib [copy] Copying 8 files to /usr/local/ant/lib [copy] Copying 2 files to /usr/local/ant/lib [copy] Copying 13 files to /usr/local/ant/bin

javadoc_check:

javadocs: [mkdir] Created dir: /opt/apache-ant-1.7.0/build/javadocs [javadoc] Generating Javadoc

 . . .

[javadoc] 114 warnings

dist_javadocs:  [mkdir] Created dir: /usr/local/ant/docs/manual/api  [copy] Copying 1180 files to /usr/local/ant/docs/manual/api

internal_dist:  [mkdir] Created dir: /usr/local/ant/etc  [copy] Copying 1 file to /usr/local/ant/lib  [copy] Copying 1 file to /usr/local/ant/lib  [copy] Copying 25 files to /usr/local/ant/lib  [copy] Copying 1 file to /usr/local/ant/lib  [copy] Copying 259 files to /usr/local/ant/docs  [copy] Copying 33 files to /usr/local/ant/docs  [copy] Copying 11 files to /usr/local/ant  [copy] Copying 15 files to /usr/local/ant/etc

BUILD SUCCESSFULTotal time: 59 seconds</pre>
<p> This will create a binary distribution of Ant in the directory you specified. </p>
<p> The above action does the following: </p>
<ul>
<li>If necessary it will bootstrap the Ant code. Bootstrapping involves the manual compilation of enough Ant code to be able to run Ant. The bootstrapped Ant is used for the remainder of the build steps. </li>
<li>Invokes the bootstrapped Ant with the parameters passed to the build script. In this case, these parameters define an Ant property value and specify the &#8220;dist&#8221; target in Ant&#8217;s own build.xml file. </li>
<li>Create the ant.jar and ant-launcher.jar JAR files </li>
<li>Create optional JARs for which the build had the relevant libraries. If a particular library is missing from ANT_HOME/lib/optional, then the matching ant- JAR file will not be created. For example, ant-junit.jar is only built if there is a junit.jar in the optional directory. </li>
</ul>
<p><span style="font-weight: bold; font-style: italic;font-size:100%;" >Other ways to build and install</span>
<p>On most occasions you will not need to explicitly bootstrap Ant since the build scripts do that for you. If however, the build file you are using makes use of features not yet compiled into the bootstrapped Ant, you will need to manually bootstrap. Run bootstrap.bat (Windows) or bootstrap.sh (UNIX) to build a new bootstrap version of Ant. If you wish to install the build into the current ANT_HOME directory, you can use: </p>
<pre>  build install        (Windows) sh build.sh install  (Unix)</pre>
<p> You can avoid the lengthy Javadoc step, if desired, with: </p>
<pre>  build install-lite        (Windows) sh build.sh install-lite  (Unix)</pre>
<p> This will only install the bin and lib directories. </p>
<p> Both the install and install-lite targets will overwrite the current Ant version in ANT_HOME. </p>
<p><span style="font-weight: bold;font-size:130%;" >Checking the Installation</span>
<p> Now we have built and installed Ant, and we can check if everything works properly, as shown below. </p>
<pre>[root@nimal ~]# which ant/usr/local/ant/bin/ant[root@nimal ~]# ant -versionApache Ant version 1.7.0 compiled on November 13 2007</pre>
<input name="action" value="edit" type="hidden">       This is just a brief document related to Ant installation which I did on a RHEL4 server. I think this should work on other environments as well, but I&#8217;m not sure about that. If someone of you try this using my doc and if you are successful just let me know via a comment. Also if you have any doubts you can ask me, but I can assure answers, if-and-only-if its under my intellectual capacity <img src='http://nimal.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Reference: <a href="http://ant.apache.org/manual/install.html">http://ant.apache.org/manual/install.html</a></p>
<p><a href="http://nimal.info/blog/2008/ant-installation/">Ant: Installation</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></content:encoded>
			<wfw:commentRss>http://nimal.info/blog/2008/ant-installation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ant: Hello World in Ant</title>
		<link>http://nimal.info/blog/2008/ant-hello-world-in-ant/</link>
		<comments>http://nimal.info/blog/2008/ant-hello-world-in-ant/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 13:46:00 +0000</pubDate>
		<dc:creator>Nimal</dc:creator>
				<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nimal.info/blog/?p=62</guid>
		<description><![CDATA[<p>This is a simple reference of my, which might be helpful to someone after installing Ant and do some playing. Use a text editor to create a file called build.xml: &#60;?xml version=&#34;1.0&#34;?&#62;&#60;project name=&#34;My Project&#34; default=&#34;hello&#34;&#62; &#60;target name=&#34;hello&#34;&#62; &#60;echo&#62;Hello World!&#60;/echo&#62; &#60;/target&#62; &#8230; <a href="http://nimal.info/blog/2008/ant-hello-world-in-ant/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://nimal.info/blog/2008/ant-hello-world-in-ant/">Ant: Hello World in Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></description>
			<content:encoded><![CDATA[<div>
<div>This is a simple reference of my, which might be helpful to someone after installing <a href="http://thetalkouttrojans.blogspot.com/2008/01/apache-ant.html">Ant</a> and do some playing.</p>
<p>Use a text editor to create a file called <i>build.xml</i>:
<pre>&lt;?xml version=&quot;1.0&quot;?&gt;&lt;project name=&quot;My Project&quot; default=&quot;hello&quot;&gt;    &lt;target name=&quot;hello&quot;&gt;       &lt;echo&gt;Hello World!&lt;/echo&gt;

    &lt;/target&gt;  &lt;/project&gt;</pre>
<p> The first line in the file tells the system that this is an XML file. The next line tells ant that we have a project named &quot;My Project&quot; and that it has a default target called &quot;hello&quot;. Note that the file must always start with a &lt;project&gt; and end with a &lt;/project&gt;. The central three lines are the one and only target in the file. They give the target a name and the target has just one task called &quot;echo&quot; </p>
<p> You can now open a shell and type &quot;ant&quot;. The default task is a required attribute of the project. Each target must have a name. </p>
<h2><u><font size="2">Output of Hello World</font></u></h2>
<pre>[root@nimal ant-tests]# antBuildfile: build.xml

hello:     [echo] Hello World!

BUILD SUCCESSFULTotal time: 1 second[root@nimal ant-tests]# </pre>
<h2><u><font size="2">Variations</font></u></h2>
<p> The following variations of <i>echo</i> will also give similar output. </p>
<pre>&lt;echo message=&quot;Hello There!&quot;&gt;&lt;/echo&gt;&lt;echo message=&quot;Hello There!&quot;/&gt;</pre>
</div></div>
<p><br clear="all"></p>
<p><a href="http://nimal.info/blog/2008/ant-hello-world-in-ant/">Ant: Hello World in Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></content:encoded>
			<wfw:commentRss>http://nimal.info/blog/2008/ant-hello-world-in-ant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Ant</title>
		<link>http://nimal.info/blog/2008/apache-ant/</link>
		<comments>http://nimal.info/blog/2008/apache-ant/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 18:10:00 +0000</pubDate>
		<dc:creator>Nimal</dc:creator>
				<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://nimal.info/blog/?p=59</guid>
		<description><![CDATA[<p>What is Apache Ant? Apache Ant (or simply Ant) is an XML-based build scripting language used heavily by the Open Source community. This is specially handy when it come is to automating the build process. Also Ant is infamous for &#8230; <a href="http://nimal.info/blog/2008/apache-ant/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://nimal.info/blog/2008/apache-ant/">Apache Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></description>
			<content:encoded><![CDATA[<div class="gmail_quote"><span style="font-weight: bold; font-style: italic;font-size:100%;" >What is Apache Ant?</span></p>
<p>Apache Ant (or simply Ant) is an XML-based build scripting language used heavily by the Open Source community. This is specially handy when it come is to automating the build process. Also Ant is infamous for its good going with Java projects, though it is very much capable of doing various other stuff.</p>
<p><span style="font-weight: bold; font-style: italic;">Apache Ant:</span>
<ul>
<li>An operating system and language neutral XML based &#8220;Build Tool&#8221;</li>
<li>A scripting language for executing any complex file-system processes that can be run from a command line interface</li>
<li>A.N.T. â€“ Another Neat Tool</li>
<li>User for Building the Project </li>
</ul>
<p> <span style="font-weight: bold; font-style: italic;">Ant Terminology</span>
<ul>
<li>Ant Project â€“ a collection of named targets that can run in any order depending on the time stamps of the files in the file system. Each build file contains one project.</li>
<li>Ant Target â€“ a fixed series of ant tasks in a specified order that can depend on other named targets. Targets can depend only on other targets, not on projects or tasks.</li>
<li>Ant Task â€“ something that ant can execute such as a compile, copy or replace. Most tasks have very convenient default values. See the Ant manual for a complete list of tasks. </li>
</ul>
<p> <span style="font-weight: bold; font-style: italic;">Links</span></p>
<p>There is lot more to read and learn about Ant and even I don&#8217;t know much about it except to my using it for a build automation project. So it&#8217;ll be best to read from some external resources to get a better idea about it.
<ul>
<li><a href="http://en.wikipedia.org/wiki/Apache_Ant">Wikipedia</a></li>
<li><a href="http://en.wikibooks.org/wiki/Apache_Ant">Wikibooks</a></li>
</ul>
<p> Happy Building with Apache Ant&#8230;!</p>
</div>
<p><a href="http://nimal.info/blog/2008/apache-ant/">Apache Ant</a> is a post from: <a href="http://nimal.info/blog">Nimal&#039;s Weblog</a> <br/><br/>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.</p>]]></content:encoded>
			<wfw:commentRss>http://nimal.info/blog/2008/apache-ant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

