CSE 70, Spring 2010

Software Engineering

Lab Instructions


Goal

In this lab you'll use javadoc to generate documentation for your project code and add a target to your Ant build file that automates this process.

Generate documentation with javadoc

Your first task is to generate documentation for your project code by running javadoc manually. You will need to pass javadoc command-line arguments specifying the source directory, the name of the package, and the destination directory, doc. You may want to refer to these simple javadoc examples. The easiest way to do this is to make the trunk your working directory and specify the source directory src and target directory doc. Once you've done this, use a browser to examine the resulting HTML files in the doc directory.

Eclipse can also invoke javadoc to generate documentation. To do this, in the Project menu, select Generate Javadoc... and follow the process, paying attention to the settings and options in the resulgint dialogs.

Create a javadoc Ant target

Once you know how to run javadoc manually and have seen the results, your next task is to add a target called javadoc to your build.xml so that running ant javadoc automatically generates documentation into your doc directory. For this purpose, Ant provides a handy javadoc task. To remain consistent with the style in your build file, you will probably want to add a property naming the doc location.

CAUTION: Make sure to update the clean target so it deletes your doc directory in addition to the other generated files. Test both targets to see doc is gone after running ant clean and is regenerated from scratch using ant javadoc. Also make sure your svn:ignore property includes doc so the generated documentation won't accidentally end up in your repository.


Valid XHTML 1.0 Strict Valid CSS!