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

纵饮孤独 提交于 2019-12-20 09:53:36

问题


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?


回答1:


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

find . -type f -name "*.java" | xargs javadoc -d outputdir 



回答2:


On Windows you can do it like this:

Generate file list:

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

Generate javadoc:

javadoc -d outputdir @file.lst


来源:https://stackoverflow.com/questions/4709692/generic-javadoc-command-that-always-generates-all-javadocs-in-a-given-tree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!