Now that we have the ability to test our code, next will need the ability to generate documentation for our project. Ant has a builtin javadoc task that is perfect for this and we can integrate this into our build procedure. As the project grows in complexity, these documents will become more and more useful.

    <!-- ==========================================================
       
             javadoc
             Generate a java document based on source code comments
       
         ========================================================== -->
       
    <target name="javadoc" description="api generation">
        <echo level="info">
    ***********************************************************************
    *
    * Generating documentation
    *
    ***********************************************************************
        </echo>    
       
        <property name="dir.build.docs.api" value="${dir.build.docs}/api"/>
        <property name="doc.title" value="Java Persistence Project"/>
        <property name="doc.copyright" value="Copyright &#169; 2009 Travis Osterman. All Rights Reserved."/>
       
        <delete dir="${dir.build.docs.api}"/>
       
        <mkdir dir="${dir.build.docs}"/>
        <mkdir dir="${dir.build.docs.api}"/>
       
        <javadoc
            destdir="${dir.build.docs.api}"
            author="true"
            version="true"
            use="true"
            windowtitle="${doc.title}"
            failonerror="true"
            classpathref="classpath"
            >
        <fileset dir="${dir.src}" defaultexcludes="yes">
          <include name="**/*.java"/>
          <exclude name="**/*Test.java"/>
        </fileset>
           
        <!-- custom html -->
        <doctitle><![CDATA[<h1>${doc.title}</h1>]]></doctitle>
        <bottom><![CDATA[<i>${doc.copyright}</i>]]></bottom>

        <!-- custom tags -->
        <tag name="todo"
             description="&lt;span class=&quot;todo&quot;&gt;todo&lt;/span&gt;" />
        <tag name="xxx"
             description="&lt;span class=&quot;xxx&quot;&gt;needs refactored&lt;/span&gt;" />
        <tag name="fixme"
             description="&lt;span class=&quot;fixme&quot;&gt;needs fixed&lt;/span&gt;" />
        <tag name="TODO"
             description="&lt;span class=&quot;todo&quot;&gt;todo&lt;/span&gt;" />
        <tag name="XXX"
             description="&lt;span class=&quot;xxx&quot;&gt;needs refactored&lt;/span&gt;" />
        <tag name="FIXME"
             description="&lt;span class=&quot;fixme&quot;&gt;needs fixed&lt;/span&gt;" />
       
        <!-- link to other api's -->
           
        <!-- java api -->
        <link href="http://java.sun.com/j2se/1.5/docs/api"/>
       
      </javadoc>
       
    </target>

And now add comments using /** comment */ and try

> ant javadoc

Now access JP\build\docs\api

> ant svn

commit