Learn the fundamentals of Apache Ant, a powerful and easy to use open-source build tool mainly for Java, providing a number of built-in tasks for compiling, assembling, and testing Java applications. Ant can also be used effectively to build C or C++ applications or perform file management tasks for any sort of project.
Ant Tasks Now that you have a basic understanding of Ant's structure, let's have a closer look at tasks. Tasks are where the real work gets done. There are many standard tasks available within Ant. We will not be able to explore all of them, but we will certainly cover many of the main tasks that you may have a need for. For a complete list of available tasks open a browser and go to ant. apache. org/manual. Here you will find all the reference information. Click on Ant tasks, then lists of tasks for a complete listing. You will undoubtedly use this manual as your ongoing reference. Click the back button, then click overview of Ant tasks. Here tasks are sorted by type of action. Again, this will be a great future reference. We will cover many of these in this module. Also, since Ant is extendable, there are many optional tasks that have been developed beyond the standard tasks. These require optional libraries, jar files to be in your class path to take advantage of them. Click on library dependencies and you will see a list of many of these. Here you can see libraries for tasks for controlling junit, file manipulation, logging, FTP, mymail etc. . You can certainly return here to explore further on your own. For now let's begin with some of the more common tasks.
Ant Elements Now let's discuss other Ant elements that are not tasks. They are sometimes referred to as data types. But I prefer not to use that term as they are very unlike data types in programming languages. I'll just refer to them as elements. You will be using these elements in your build files often. First we will discuss pattern sets, which you've already have a few glimpses of in the previous module. These describe groups of patterns of files and/or directories. Then we'll look at DirectSet and FileSet, which deal with groups of directories and files respectively. FileList deals with explicit lists of files. FileMapper translates file names. FilterReader and FilterChain are used to filter certain types of files. Selectors provide more control over file selection. Class FileSet is the same as FileSet, but for class files. Paths resemble file system paths. And finally we'll look at listeners and loggers. Listeners can alert you about specific events within a build and loggers can be configured to log events in specific formats. Let's just move on and look specifically at each of these.