ANT’s best practices - II
10 May 2008In this post, I will continue talking about ANT’s best practices.
Build file should be self-documented.
Add target descriptions with targets is the easiest way to accomplish this. To view the help text of each taret, use the following command:
ant –projecthelp
<target name="compile" description="Compiles code, output goes to the build dir.">
The conventions is to include descriptions for all of the targets that you wish programmers to invoke from the command line. There are some internal targets like generating code and targets that perform intermediate processing. These internal targets are not to be documented. Some developers prefer to define a target named help that prints detailed usage information. Programmers use ant help command to view the help in this case.
<target name="help" description="Display detailed usage information"> <echo>Detailed help...</echo> </target>
There should be a target defined that removes all generated files and directories and brings everything back to its original state. This target is usually referred as clean target. The files remaining after a clean execution should be those found in version control.
<target name="clean" description="Destroys all generated files and dirs."> <delete dir="${dir.build}"/> <delete dir="${dir.dist}"/> </target>
continued …
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: ANT's best practices - II