Ant Counter

This is the site for Antcount.

Antcount is an external addon to Ant. Ant is a powerful tool that was first designed to build Java project but which can do much more. More information about Ant can be found on its Apache web site.

The first target of antcount is to count the number of lines in a file. However, it can become a real statistics tool that parses log files.

I first implemented the counter as an Ant task. However, there are some limits to this approach. For example, support for resource collections would be a must. This support will come with Ant 1.7. It allows a task to parse not only regular files, but also zipped files. This is great for parsing daily archived log! Flexibility is an other point that could be put against tasks. It's quite hard to satisfy everyone in such a topic than statistics. Everyone has his own needs... So I decided to move to a filter approach. One could then use the concat task an use the antcount filter set to get some useful stats. Flexibility is given by the other existing Ant filters. If you use Ant 1.7, you can use resource collections and future features like this one will be suported as well.

Antcount is Open-source software under the LGPL license.

For example, the following will parse one file called and get the number of lines and the number of words. Nothing will be printed on the console, thanks to stopfilter.

	<fileset file="" />
		<countfilter property="nb.lines" />
			<stringtokenizer />
			<countfilter property="nb.words" />
		<stopfilter />