\”The Entity Bean is on vacation.\”

March 18, 2006

Apache ANT – An Introduction And A Few Tips & Tricks

Filed under: Apache Ant, General, How-Tos — Gautam Satpathy @ 1:55 am

Apache Ant Logo

Apache Ant is currently in version 1.6.5 (released on June 2, 2005). I have used Ant since the 1.1.x days and I must say that I fell in love with Ant the day I first downloaded and played with it. And the love endures till this day I remember voting for the official Ant logo in August/September 2001. See the post by Christoph Wilhelms about the vote. And the voting results here. I was a part of the ant-user & ant-dev mailing lists at that time and I had voted for the logo that won!!!

Anyway, enough nostalgia. Lets talk about Ant…

What is Ant?

First of all, what is Ant? As the Ant developers say – Ant is a Java-based build tool. Okay. So what you say? Well, Ant is a tool that makes it possible to do routine stuff in a easy, repeatable, & robust way. Once you have mastered the Ant concepts, how to write Ant scripts (XML files) and how to make use of the power of Ant, you will be left wondering how you managed all those tasks before Ant came along! In fact, I use Ant for a variety of tasks, over and above the software development related tasks that it is meant for. For example, I use Ant to generate a search index for this blog and FTP it to the server everytime I make a post. I use Ant programatically (no build.xml file) in a lot of my programs where I need common functions like file copy, ftp, etc. Why reinvent the wheel when Ant is available?

Installing & Using Ant

Installing Ant is a breeze. Just download the latest binaries from the Ant web site. You should download the ZIP archive. Unzip the archive to a convenient folder (I use D:\Java\apache-ant-1.6.5). You will end up with a folder like in the screen shot below:

Apace Ant - Folder Structure

Figure 1. Apache Ant – Folder Structure

Note that I have highlighted the bin folder. This has MS Dos Batch files that you can use to run Ant. We dn’t have to worry about the batch files and the commands they contain at this time. I will go over some of that stuff in a later post because there are a couple of points that relate to extending Ant with third party Ant Tasks etc.

To run Ant, we need to do two things:

  • Set the ANT_HOME Environment Variable – This will point to the root folder of your Ant installation. D:\Java\apache-ant-1.6.5 in the case of the screen shot above.
  • Add the Ant BIN folder to the System Path – Add the BIN folder to you path. D:\Java\apache-ant-1.6.5\bin in the case of the screen shot above.

That’s all you need to do to get Ant installed and running.

To test your Ant installation, open a MS-DOS command prompt, change to any folder of your choice (say D:\) and type ant.bat.You will see something like the stuff below (figure 2).

Apache Ant - The First Test Run

Figure 2. Apache Ant – The First Test Run

This proves that Ant has been properly installed and all the settings we need are in place. We can now test Ant with a simple build file (we will cover build files in more detail in subsequent posts).

A Simple Build File:

Lets write a simple build file and test our Ant installation. At this time, just download this file (right click and select Save As) and save it into a suitable folder (say D:\AntTest\). Open a MS Dos command window and change into the folder in which you placed the build.xml file (say d:\AntTest\). Type ant -verbose in the command prompt. You should see something like the screen shot below:

Apache Ant - The First Test Results

Figure 3. Apache Ant – First Run Results

Okay, what did we do here? First of all we told Ant to delete the classes folder under the root folder (D:\AntTest\ in this case). Note that the classes folder did not exist at this time. However Ant can handle situations like that! Next we tell Ant to create a new classes folder under the root folder. After that we told Ant to copy our build file, build.xml, from the root folder to the classes folder. That’s it! Short and sweet but it demonstrates that our Ant installation works.

The screen shot below shows the D:\AntTest\ folder contents after the test run.

Apache Ant - Test folder contents after first test run

Figure 4. Apache Ant – Test folder contents after first test run

Well, we now have a working Apache Ant installation and have actually executed a build using Ant. Next we will look at some Ant concepts and how to write good build files.

NEXT – Ant Concepts, Build Files.

13 Comments »

  1. DOWN BUT NOT OUT CAN BE SAID RIGHTLY
    The grip of the Majlis-e-ittehadul Muslimeen on the community remains strong, despite minor dents.
    WITH A Member representing Hyderabad in the Lok Sabha, five members in the Andhra Pradesh Assembly, 40 corporators in Hyderabad and 95-plus members elected to various municipal bodies in Andhra Pradesh, the All-India Majlis-e-Ittehadul Muslimeen is one of the foremost representatives of the city’s Muslims and the most powerful Muslim party in India and one can see the partys strenghth if it goes to Hyderabad old city everywhere u look u can see MIM written on walls ,lightpoles and buildings leaving aside flags and posters of its Leadership and there small Offices . The Majlis has brought lot of development to the Old part of the city even after it is said it hasnt done anything by its opponents who are mostly Ex Majlis workers.
    The Majlis was formed in 1927 “for educational and social uplift of Muslims”. But it articulated the position that “the ruler and throne (Nizam) are symbols of the political and cultural rights of the Muslim community… (and) this status must continue forever”.
    The Majlis pitted itself against the Andhra Mahasabha and the communists who questioned the feudal order that sustained the Nizam’s rule. It also bitterly opposed the Arya Samaj, which gave social and cultural expression to the aspirations of the urban Hindu population in the Hyderabad State of those days.
    By the mid-1940s, the Majlis had come to represent a remarkably aggressive and violent face of Muslim communal politics as it organised the razakars (volunteers) to defend the “independence” of this “Muslim” State from merger with the Indian Union.
    According to historians, over 1,50,000 such `volunteers’ were organised by the Majlis for the Nizam State’s defence but they are remembered for unleashing unparalleled violence against Hindu populations, the communists and all those who opposed the Nizam’s “go it alone” policy. It is estimated that during the height of the razakar `agitation’, over 30,000 people had taken shelter in the Secunderabad cantonment alone to protect themselves from these `volunteers’.
    But the razakars could do little against the Indian Army and did not even put up a fight. Kasim Rizvi, the Majlis leader, was imprisoned and the organisation banned in 1948. Rizvi was released in 1957 on the undertaking that he would leave for Pakistan in 48 hours. Before he left though, Rizvi met some of the erstwhile activists of the Majlis and passed on the presidentship to Abdul Wahed Owaisi, a famous lawyer and an Islamic scholar who also was jailed for nearly 10 months after he took over the Majlis leadership as the then govt wanted to abolish the Majlis party but Owaisi refused to do so and was seen as a person who had financially supported the party when it was a bankrupt and weak one after the Police Action in Hyderabad State.
    Owaisi is credited with having “re-written” the Majlis constitution according to the provisions of the Indian Constitution and “the realities of Muslim minority in independent India”, according to a former journalist, Chander Srivastava. For the first decade-and-a-half after this “reinvention”, the Majlis remained, at best, a marginal player in Hyderabad politics and even though every election saw a rise in its vote share, it could not win more than one Assembly seat.
    The 1970s saw an upswing in Majlis’ political fortunes. In 1969, it won back its party headquarters, Dar-us-Salaam — a sprawling 4.5-acre compound in the heart of the New City. It also won compensation which was used to set up an ITI on the premises and a women’s degree college in Nizamabad town. In 1976, Salahuddin Owaisi took over the presidentship of the Majlis after his father’s demise.
    This started an important phase in the history of the Majlis as it continued expanding its educational institutions,Hospitals,Banks, including the first Muslim minority Engineering College and Medical College. Courses in MBA, MCA ,Nursing, Pharmacy and other professional degrees followed and now a daily newspaper known as Etemaad Daily. The 1970s were also a watershed in Majlis’ history as after a long period of 31 years, Hyderabad witnessed large-scale communal rioting in 1979. The Majlis came to the forefront in “defending” Muslim life and property Majlis workers could be seen at these moments defending the properties of Muslims in the wake of riots and these workers were very hard even for the police to control them even now it is a known fact that there are nearly about 2500 units of strong members who only act if there is a seirous threat to the Owaisi family and these members are under the direct orders of the Owaisi family which leads the Majlis party leaving aside thousands of workers and informers throughout the State and even outside the country far away till America and the Gulf countries.
    Salahuddin Owaisi, also known as “Salar-e-Millat” (commander of the community), has repeatedly alleged in his speeches that the Indian state has “abandoned” the Muslims to their fate. Therefore, “Muslims should stand on their own feet, rather than look to the State for help’’, he argues.
    This policy has been an unambiguous success in leveraging the Majlis today to its position of being practically the “sole spokesman” of the Muslims in Hyderabad and its environs.
    Voting figures show this clearly. From 58,000 votes in the 1962 Lok Sabha elections for the Hyderabad seat, Majlis votes rose to 1,12,000 in 1980. The clear articulation of this “stand on one’s feet” policy in education and `protection’ during riots doubled its vote-share by 1984. Salahuddin Owaisi won the seat for the first time, polling 2.22 lakh votes. This vote-share doubled in the 1989 Lok Sabha elections to over four lakhs.
    The Majlis has since continued its hold on the Hyderabad seat winning about five-and-a-half lakh votes each time.
    Despite remarkable economic prosperity and negligible communal violence in the past decade, the hold of the Majlis on the Muslims of Hyderabad remains, despite minor dents. And despite widespread allegations of Majlis leaders having “made money”, most ordinary Muslims continue to support them because, as one bank executive put it “they represent our issues clearly and unambiguously’’. An old Historian Bakhtiyar khan says the Owaisi family was a rich family even before entering Politics and he says he had seen the late Majlis leader Abdul Wahed Owaisi in an American Buick car at a time when rarely cars were seen on Hyderabad Roads and the family had strong relations with the ersthwhile Nizams of Hyderabad and the Paighs even now the family is considered to be one of the richest familes in Hyderabad.
    A university teacher says that the Majlis helped Muslims live with dignity and security at a time when they were under attack and even took the fear out of them after the Police action and adds that he has seen Majlis leaders in the front at times confronting with the Police and the Govt.
    Asaduddin Owaisi, the articulate UK educated barrister son of Salahuddin Owaisi and Former leader of the Majlis’ Legislature party and now an MP himself who has travelled across the globe meeting world leaders and organizatons and even in war zones compares the Majlis to the Black Power movement of America.
    The Majlis that emerged after 1957 is a completely different entity from its pre-independence edition, he says adding that comparisons with that bloody past are “misleading and mischievous”. “That Majlis was fighting for state power, while we have no such ambitions or illusions”.
    He stoutly defends the need for “an independent political voice” for the minorities, which is willing to defend them and project their issues “firmly”.
    “How can an independent articulation of minority interests and aspirations be termed communal,” he asks and contests any definition of democracy which questions the loyalty of minorities if they assert their independent political identity. “We are a threat not only to the BJP and Hindu communalism, but also to Muslim extremism,” Asaduddin claims. “By providing a legitimate political vent for Muslims to voice their aspirations and fears, we are preventing the rise of political extremism and religious obscurantism when the community is under unprecedented attack from Hindu communalists and the state’’. He can be seen in his speeches speaking against terrorism in the Country and says if the time arises Majlis will stand side by side in defending the Nation

    Comment by Moin yar Khan — October 10, 2006 @ 12:09 pm

  2. locate a dermatologist

    Pros and cons of locate a dermatologist.

    Trackback by locate a dermatologist — February 23, 2007 @ 5:38 pm

  3. anal video post

    Reviews on anal video post.

    Trackback by anal video post — April 29, 2007 @ 12:24 am

  4. change wind

    Approved articles about change wind.

    Trackback by change wind — June 1, 2007 @ 2:17 am

  5. black gay man

    ka-ka-sh-ka 3876072 Pros and cons of black gay man.

    Trackback by black gay man — June 1, 2007 @ 2:20 am

  6. brother brother

    Technologies of brother brother

    Trackback by brother brother — June 1, 2007 @ 2:39 am

  7. teen boy thumbnails

    ka-ka-sh-ka 3876072 Variants of teen boy thumbnails.

    Trackback by teen boy thumbnails — June 7, 2007 @ 11:40 pm

  8. candidate goddess

    Latest candidate goddess news

    Trackback by candidate goddess — June 7, 2007 @ 11:47 pm

  9. hey if i say D:\Programme\Red5>ant.bat
    it loading loading loading many things after that i get this error
    and their is no file published

    BUILD FAILED
    D:\Programme\Red5\build.xml:205: The following err
    D:\Programme\Red5\build.xml:221: The following err
    D:\Programme\Red5\build.xml:165: impossible to res
    resolve failed – see output for details

    ???

    Comment by scarface — March 13, 2008 @ 4:46 pm

  10. Hello webmaster
    I would like to share with you a link to your site
    write me here preonrelt@mail.ru

    Comment by Alexwebmaster — March 3, 2009 @ 4:13 pm

  11. Looks like you are a true expert. Did ya study about the topic? lawl

    Comment by Reagueautok — December 12, 2009 @ 7:56 am

  12. Wow, that’s what I was looking for, what a data!

    present here at this webpage, thanks admin of this website.

    Comment by nursing test banks — May 3, 2015 @ 8:12 am

  13. lowongan

    Apache ANT – An Introduction And A Few Tips & Tricks | \”The Entity Bean is on vacation.\”

    Trackback by lowongan — September 19, 2015 @ 7:18 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.