August 5, 2021

ANT interview question and Answers

ANT interview question and Answers

Online Training from India1. What is Ant?

Ans: Ant is an open source code .It is Java-based build tool sponsored by Apache Software Foundation. It is a program for putting all the pieces of a program together. A simple definition might state that “Ant is a Java-based build tool from Apache Software Foundation”. Ant is kind of like Make.

2. Why do you call it Ant?

Ans: The ant is acronym of \”Another Neat Tool\” according to James Duncan Davidson. Ants are very small and can carry heavy weight. So as Job of Apache ant. Its name is called ANT.

3. What is a build tool?

Ans: A built tool is software which is used to build project, directory structure, copy necessary files to that directory ,compile files ,create jars, set path and class-path ,Build the documentation ,Validate the source code, deploy, debug, and run, clear the workspace.

4. Explain the concepts of ANT?

ANS: Ant is a build tool that is java based. A build tool performs the following tasks:

Ant is an open source project available under the Apache license. Therefore, its source code can be downloaded and modified.
Additionally, Ant uses XML build files which make its development easy.

Cross Platform:
Use of XML along with Java makes Ant makes it the perfect solution for developing programs designed to run or be built across a range of different operating systems.

New tasks are used to extend the capabilities of the build process, while build listeners are used to help hook into the build process to add extra error tracking functionality.

As Ant is extensible and open, it can be integrated with any editor or development environment easily.

5. What are the capabilities of ANT?

Ans: ANT tool is extended by using java classes. The configuration files are XML-based. Each task of building directory tree is executed by using the object that implements the Task interface.

ANT provides the cross-platform deployment that can run on any platform.

6. Why Ant is a great build tool?

Ans: Ant is great build tool due to following reason:

1. Ant is a Java-based build tool designed to be cross-platform, easy to use, extensible, and scalable.

2. Ant can be used in a small personal project as well as ant can be used in a large, multi-team software project.

3. Ant syntax is very easy to learn.

4. Ant syntax used XML format .We need only specifies our task only on build.xml file.

5. Ant is easy to use .eliminating the full-time make file engineer common on large Make-based software projects.

7. How many ways we can set properties into build ant file?

Ans: There are six ways to set properties:
1. Supplying both the name and value attribute.
<property name=”src.dir” value=”src”/>

2. Supplying both the name and refid attribute.
3. Setting the file attribute with the filename of the property file to load.
4. Setting the url attribute with the url from which to load the properties.
5. Setting the resource attribute with the resource name of the property file to load.
6. Setting the environment attribute with a prefix to use.

We can use the combinations of all above in our build files .But only one should be used at a time.

8. How you can explain ant property?

Ans: A project can have a set of properties .A property has name and value .The name is case sensitive and Properties are immutable this mean once set property its will not change. Properties may be used in the value of task attributes.

9. What is dependency? How it is used into ant? What is its use?

Ans: Dependencies are do something when complete it. In ant we are using dependencies by using an attribute “depends” .In this attribute we have pass values for which the target depends .This mean we first need to execute the target which is passed into this attribute.

10. How we can create a jar using Ant?

Ans: To make a jar of classes we need set target as jar. In this target we need to make directory in which jar will stored. Then we need jar tag to make the jar .In this tag we have pass two attributes first is name of destination directory and second one is the name of base directory where our all class files are stored .We need a manifest to create a jar file. In manifest tag we have pass two attributes first is name of manifest file name and second is its value.

11. How you can prepare a project in ANT?

Ans: We can prepare a project by making a build.xml as a build file and using following tag. Inside this tag we have defined standard targets (such as build, clean etc), etc.

12. What is different between Ant and Make?

Ans: The most important difference between Ant and Make is that Ant uses XML to describe the build process and its dependencies, whereas Make uses its Makefile format. By default the ant XML file is named build.xml.

13. What is IVY?

Ans: Ivy is a popular dependency manager .IVY is basically focused on flexibility and simplicity.
The latest version of Ivy is 2.1.0.

Key features of the 2.1.0 release are
•The Key features of Ivy is enhanced Maven2 compatibility, with several bug fixes and more pom features covered.
•new options for the Ivy Ant tasks and commandline
•configuration intersections and configuration groups
•numerous bug fixes & improvements as documented in Jira and in the release notes

14. How we can set path PATH and CLASSPATH into an ant build file?

Ans: Ant does not need to set class path.