Apache Ant Interview questions

Apache Ant is a Java library and command-line tool for automating software build processes. It is originated from the Apache Tomcat project in early 2000. It was a replacement for the Make build tool of Unix and was created due to a number of problems with Unix's make. Below we have listed some possible Apache Ant Interview questions and answers for developers who looking for Interview questions on Apache Ant.
  • Q1.

    What is Apache Ant?

     

    Apache Ant is a Java library and command-line tool for automating software build processes.It drives the processes or instructions described in build files as targets and extension points dependent upon each other.The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks. Source: http://ant.apache.org/

  • Q2.

    In which language Apache Ant is written?

     

    Ant is written in Java.

  • Q3.

    What is minimum version of Java is required to run Apache Ant 1.9.x?

     

    Java 1.5 is required for Apache Ant 1.9.x.

  • Q4.

    List some basic functions performed by Ant.

     

    Ant tool is used for:-

    • Compiling Java code into bytecode
    • Placing this bytecode in a package
    • Deployment to production systems
    • Document creation and release notes preparation.
  • Q5.

    How to set Classpath in Ant script?

     

    Use below code snippet to set Classpath in Ant script

    
    <path id="build.classpath">
    <fileset dir="${build.lib}" includes="**/*.jar"/>
    <fileset dir="${build.class"}/>
    </path>
    
    <target….>
    <javac….>
    <classpath field="build.classpath"/>
    </javac>
    </target>
    
    <target….>
    <javac….>
    <classpath field="build.classpath"/>
    </javac>
    </target>