Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generic javadoc command that always generates all javadocs in a given tree?

Tags:

When I have to generate javadocs for a new, unfamiliar project, I find that I spend a long time trying to simply write the correct command, specifying all the packages, all the source trees, etc. It's time-consuming and error-prone: I'm probably missing some source.

So let's say I have a directory myproj, and underneath it there are a few packages (and various other resources and stuff), and under those package directories there are eventually some src/ directories, and then lots of my/awesome/java/project/package type structures.

Is there a single command that will always recurse over EVERYTHING and generate ALL javadocs in one output location? I don't care how long it takes. Something brain-dead like javadoc -d doc -sourcepath . -subpackages * would be great. Failing that, what's the easiest way to generate all javadocs, no matter what the directory structure is?

like image 268
Steve Bennett Avatar asked Jan 17 '11 03:01

Steve Bennett


People also ask

What type of files is generated by the javadoc command?

The javadoc command has a default built-in doclet, called the Standard Doclet, that generates HTML-formatted API documentation. You can write your own doclet to generate HTML, XML, MIF, RTF or whatever output format you want.

How do I create a javadoc for a whole project?

To generate JavaDoc in Eclipse: –Select “Generate JavaDoc” option from Project menu and a wizard will appear. Specify the location for the JavaDoc file on your computer, by default it will be in the C drive. Select the project and then the packages for which you want to create the JavaDoc file.

How do I create an automatic javadoc?

In the Package Explorer view, select a Java project and click Project > Generate Javadoc with Diagrams > Automatically. In the Generate Javadoc wizard, under Javadoc command, select the Javadoc command (an executable file).

Which command is used to create a documentation API?

You can use the javadoc tool to generate the API documentation or the implementation documentation for a set of source files. You can run the javadoc tool on entire packages, individual source files, or both.


2 Answers

Use find to find all Java source files and then send them to javadoc:

find . -type f -name "*.java" | xargs javadoc -d outputdir  
like image 99
dogbane Avatar answered Sep 26 '22 01:09

dogbane


On Windows you can do it like this:

Generate file list:

dir /s /b *.java > file.lst 

Generate javadoc:

javadoc -d outputdir @file.lst 
like image 40
stian Avatar answered Sep 22 '22 01:09

stian