Javadoc is a very powerful and helpful tool of java. You can document your source, as well as insert installation or configuration information. The usage of javadoc in ant is very comfortable, setup once, use every build.
Here is an example of a simple javadoc ant task:
<target name="createJavadoc"> <!-- this classpath is only necessary when using 3rd party libs or annotation processing --> <path id="annotations.classpath"> <fileset dir="."> <include name="lib/**/*.jar" /> </fileset> </path> <!-- creata javaDoc for package com.pbo.* inside src folder. Store javadoc in folder javaDoc --> <javadoc packagenames="com.pbo.*" sourcepath="src" defaultexcludes="yes" destdir="javaDoc" author="true" version="true" use="true" classpathref="annotations.classpath" splitindex="true" nonavbar="true" windowtitle="F1 Betting Game : Documentation"> <doctitle> <![CDATA[<h1>F1 Betting Game</h1>]]> </doctitle> <bottom> <![CDATA[Copyright © Philipp Boss.<br/> <b>Please contact Philipp Boss in case of questions</b>]]> </bottom> </javadoc> </target>
This task creates the javadoc for the package com.pbo.* inside the src-folder and stores the created doc files inside the javaDoc folder.
The parameter nonavbar hides the navigation bar in the created doc files. For my opinion this generates more „clean“ javadoc pages. The windowtitle is the title of the html-page (what you can see in your browser tab), the doctitle is the one beeing displayed inside the web page. The value of bottom is beeing displayed at the end of the page.
Here you can see the created page:
