Apache Ant or more commonly referred to as Ant, is a Java based build tool that is specifically for users to build their Java project into a system. It uses XML files to describe the project’s build process and its dependencies. Ant was originally developed by James Duncan Davidson as another build system too different from Makefile.
Why call it Ant? One would definitely think of the insect when seeing the name, but it has another meaning than one thinks. According to Apache Ant 101 (a pdf file located at this website: https://www6.software.ibm.com/developerworks/education/j-apant/j-apant-ltr.pdf), the name Ant is actually an acronym from the words another neat tool
For this build system experience I had to write up the eight code katas:
1. Create a script to print out “Hello World”
2. Immutable properties in Ant
3. Ant dependencies
4. Compile a Java file with Ant script
5. Execute the program with an Ant script
6. Use Ant script to create the Javadocs
7. Create a target in the script from code kata 4 to clean up build directory
8. Pack everything with Ant script
The first three katas were pretty easy to get through since it was mainly to understand
how things work in Ant. For example, in code kata 2, I had to implement two <property> elements with the same name of my.property and assign a value of 1 and 2. An <property> element in Ant can be thought of as a variable that one can assign a value/path location to the <property>. However, once it is assigned the value it will be immutable; in other words it means it can’t be changed. Therefore, when the script was executed I saw the value of 1 was printed; not the value of 2 because of immutability.
In code kata 5 I was amazed at how a few simple tags written in the XML file could execute a Java file without the use of an IDE or the use of typing the command to compile the file etc. Another code kata that I was amazed at is the final code kata. In that code kata I had to write a script that utilize the compile, execute, and Javadocs code kata before it cleans up the directory where the class and Javadocs are located. After the cleaning it combines everything and zip it into a zip file. In that file I only had to import the previous XML from code katas 4 to 6 and then a script to zip up the entire package.
To conclude, Apache Ant gave me the experience of how to package a program into a system so I can share it with other users in the future. I also learned that by building a system it can allow other users with different operating systems and IDEs to be able to execute the program and offer suggestions or comments about the program.
No comments:
Post a Comment