Wednesday, October 31, 2012

Ant Tutorial : Learn it Today with examples!

  1. What the heck is Ant??!!
  2. Prerequisites for learning Ant.
  3. Our first project Java Project with Ant.

  1. What the heck is Ant?

    The name's Ant, Apache Ant! That's the official name that differentiates the creepy one from the tool you actually use. Ant was created by James Duncan Davidson for building Tomcat, the webserver. Ant stands for "Another Neat Tool", aptly named!

    So much for history. What does it exactly do? It builds projects. What's building a project? Its a fancy way of saying compiling all the code in your java project.

    Compiling all your java code using the javac is only manageable when you have three to four files. You may say, "Eclipse handles compiling and the build path for me!". Yes it does! That's the reason I love eclipse too! But what happens when you have thousands of files controlled by different teams to be compiled together? Eclipse goes only as far for a small team. In a production environment however, a build tool like Ant/Maven helps you.
  2. Prerequisites for Learning Ant

    The prerequisites listed here are the prerequisites required for this tutorial. We will be coding all along this tutorial with less of rambling.

    So get your Ant gear in place! 
    • Some Basic Java Knowledge  
    • Installed JDK of 1.6+
    • Eclipse : For the lazy, I have the link right here. Download the one which suits your OS and processor(32 bit or 64 bit). I assume you already know how to install eclipse.
    • Apache Ant :
      * Download the zip here.
      * Unzip it and you will find the folder apache-ant-1.8.4.
      * Place it under under the C:\ directory.
         A screenshot placed below will help you to understand the folder structure.
      Apache Ant Folder structure
      Apache Ant Folder Structure

      * Add C:\apache-ant-1.8.4\bin to your Path environment variable.
      Test it out by typing the ant command in a random location with no build.xml .
         When you type ant command in the command prompt you will see something like
    • Some knowledge of basic XML. Even if you dont know what's XML ,its fine... The language is so simple you'll learn it in 30 seconds.
  3. Our First Project with Apache Ant!

    Time to get our hands dirty! Since this is a big section in itself.Click here to start off! 

No comments:

Post a Comment