<?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>StudyJava.org &#187; Ant</title>
	<atom:link href="http://studyjava.org/category/java-tools/ant/feed" rel="self" type="application/rss+xml" />
	<link>http://studyjava.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 05 Apr 2010 11:49:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Ant</title>
		<link>http://studyjava.org/java-tools/ant/ant</link>
		<comments>http://studyjava.org/java-tools/ant/ant#comments</comments>
		<pubDate>Wed, 08 Jul 2009 04:10:43 +0000</pubDate>
		<dc:creator>rakesh</dc:creator>
				<category><![CDATA[Ant]]></category>

		<guid isPermaLink="false">http://studyjava.org/?p=50</guid>
		<description><![CDATA[What is Ant ? Ant is an open-source Java-based build tool from the Apache Software Foundation. Ant uses build files, which are simply XML files that tell the Ant program what to do. Why Ant ? 1)  Simple syntax and easy to learn(If you know XML before). 2) Easy to use. 3)  Cross-platform. 4)   [...]]]></description>
			<content:encoded><![CDATA[<p align="center">
<p><strong><span style="text-decoration: underline;">What is Ant ?</span></strong></p>
<p>Ant is an open-source Java-based build tool from the Apache Software Foundation. Ant uses build files, which are simply XML files that tell the Ant program what to do.</p>
<p><strong><span style="text-decoration: underline;">Why Ant ?</span></strong></p>
<p>1)  Simple syntax and easy to learn(If you know XML before).</p>
<p>2) Easy to use.</p>
<p>3)  Cross-platform.</p>
<p>4)   Built-in support for J2EE development, such as EJB compilation and      packaging.</p>
<p>5)  Automated deployment</p>
<p><strong><span style="text-decoration: underline;">How to install Ant ?</span></strong></p>
<p>Get the binary release and set ANT_HOME and JAVA_HOME   environment variables.</p>
<p>Configure the PATH environment variable to point ant/bin directory.</p>
<p><strong><span style="text-decoration: underline;">Creating Build file </span></strong></p>
<p>Example of a build file called build.xml</p>
<p>&lt;?xml version=“1.0”&gt;</p>
<p>&lt;project name=“firstbuild” default=“compile” &gt;</p>
<p>&lt;target name=“compile”&gt;</p>
<p>&lt;javac srcdir=“.” /&gt;</p>
<p>&lt;echo&gt;compilation complete!&lt;/echo&gt;</p>
<p>&lt;/target&gt;</p>
<p>&lt;/project&gt;</p>
<p><strong>Project:</strong></p>
<p>The &lt;project&gt; tag is the root element in the build file</p>
<p>The &lt;project&gt; tag has three attributes as follows:</p>
<ul>
<li> name</li>
<li> default</li>
<li> basedir</li>
</ul>
<ul>
<li>Name &#8211; The name attribute gives the project a name and its valuable for the purpose of identifying log outputs.</li>
<li>Default &#8211; The default attribute refers to a target name within the build file.</li>
<li>Basedir – The basedir attribute defines the root directory of a project.</li>
</ul>
<p><strong>Targets:</strong></p>
<p>A &lt;target&gt; is a single stage in the Build file.</p>
<p>The target compiles a set of files and package them into a JAR file.</p>
<p>A build file can have many targets but each should have unique name.</p>
<p>In the last example, the build file compile target contains two XML elements</p>
<ul>
<li> &lt;javac&gt; (Java Compiler to compile the java code)</li>
<li> &lt;echo&gt; (To echoes a message to the screen)</li>
</ul>
<p><strong>Example of a Target:</strong></p>
<p><em>//This target will compile the source code</em></p>
<p>&lt;target name=“build-lib”&gt;</p>
<p>&lt;javac srcdir=“${src.ejb.dir}:${src.java.dir}”</p>
<p>destdir=“${build.dir}”</p>
<p>debug=“on”</p>
<p>deprecation=“on”</p>
<p>includes=“**/*.java”</p>
<p>excludes=“${global.exclude}”&gt;</p>
<p>&lt;classpath path=“${classpath.compile}” /&gt;</p>
<p>&lt;/javac&gt;</p>
<p>&lt;/target&gt;</p>
<p><em>//This target will package the jar file</em></p>
<p>&lt;target name=“package-lib”&gt;</p>
<p>&lt;jar jarfile=“${dist}/lib/lib.jar” basedir=“${build.dir}” /&gt;</p>
<p>&lt;/target&gt;</p>
<p><strong>Tasks:</strong></p>
<p>Tasks are the smallest building blocks of a build file and they performs following works,</p>
<ul>
<li>Compiling Source Code</li>
<li>Packaging Classes</li>
<li>Retrieving file revisions from CVS</li>
<li>Copying files or directories</li>
</ul>
<p>//<em>To copy all the files from source in the projects www source directory to the dest directory to system’s weblogic installation</em></p>
<p>&lt;copy todir=“${weblogic.dir}/${weblogic.server.home}/public_html/<em>source </em>”&gt;</p>
<p>&lt;fileset dir=“${src.www.dir}/<em>dest </em>”/&gt;</p>
<p>&lt;/copy&gt;</p>
<p>Happy Learning !!!</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fstudyjava.org%2Fjava-tools%2Fant%2Fant', 'Ant')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fstudyjava.org%2Fjava-tools%2Fant%2Fant', title: '+Ant+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://studyjava.org/java-tools/ant/ant/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

