|
GettingStarted
IntroductionAnt TODO was built with simplicity and unobtrusive integration in mind. Apache Ant makes it very simple to define custom tasks and also to extend its existing API. You may already be familiar with the directory based Ant tasks, but if you're not I recommend reading up on it here. SetupYou must define the TODO Ant task by using the taskdef element like so: <taskdef name="todo" classname="org.atc.tools.ant.TODOTask" classpathref="classpath.todo" /> <!-- Make sure the classpathref contains ant-todo.jar --> Basic FeaturesYou can get Ant TODO up and running in seconds by just using the todo tag as follows: <todo /> The above will search all files in the current directory and output to stdout. Whilst this is usable, it's not the most elegant or helpful example. To make it a little more 'real-world', let's give Ant TODO a source directory to recurse, in which all files will be parsed: <todo dir="src" /> Consider the following scenario: you have one src directory with .java and .xml files in them. You want to parse all the .java files for TODOs but not the .xml. To do so you could define the following: <todo dir="src"> <include name="**/*.java" /> </todo> The above defines the src directory as the base for our files we want to parse, then declares an include pattern to enure only .java files are opened. You could of course omit the dir attribute and define the directories (and files) to be included by using just the include child elements. By default, dir will resort to the current working directory (defined by System.getProperty("user.dir");). Here's a complete build.xml to illustrate the basic concepts explained thus far. <?xml version="1.0" ?> <project name="some-project"> <taskdef name="todo" classname="org.atc.tools.ant.TODOTask"> <classpath> <fileset dir="."> <include name="**/ant-todo*.jar"/> </fileset> </classpath> </taskdef> <todo dir="src"> <include name="**/*.java" /> </todo> </project> Providing your own delimiterA feature added in 0.2 was to support providing your own delimiter. Just add delim="|" (for example) to your todo task call. Storing output in a propertyIf you want to hold the TODOs found in a property variable for use in another task (say, for emailing to your development or management team), just set the name of the property you want to use by adding property="SOME_PROP" to your task call. Note: Ant properties are immutable by design. This means that once a property is set its value cannot change. Regex SupportIf you want to normalize the TODOs found, you can pass a "pattern" attribute with a pattern that's compatible with the Pattern class and then optionally a "replace" attribute with what to replace it with, e.g. "" or "". This expression will then be applied to all TODOs. Note: you don't have to provide the "replace" attribute; if you don't by default Ant TODO will just replace with nothing (""). So if you passed "\*" as regex, Ant TODO will replace all instances of * with "". |
I think you meant <include name... rather than <includes name....
That I did, thanks mrmanc!