问题描述
我刚从CACM的一篇文章中发现,Doxygen与Java(和其他几种语言)一起工作。但Java已经有Javadoc工具。有人可以解释一种方法的利弊是什么?它们是相互排斥的吗? Doxygen有一个Maven插件吗?Doxygen具有JavaDoc不提供的许多功能,例如层次结构和合作背景的类图,更多的摘要页面,可选的源代码浏览(与文档交叉链接),在单独的页面上添加诸如@todo的附加标签支持,并且可以以TeX和PDF格式生成输出。它还允许大量的视觉定制。
由于Doxygen支持标准的JavaDoc标签,因此可以在任何使用JavaDoc注释的源代码上运行Doxygen。在没有JavaDoc的情况下运行源代码通常甚至有意义,因为图表和源代码浏览可以帮助您了解代码,即使没有文档。而且由于JavaDoc工具忽略了未知的标签,您甚至可以使用额外的Doxygen标签,而不会破坏JavaDoc生成。
已经说了这一切,我必须承认我没有使用Doxygen很长时间。我倾向于严重依赖我的IDE来提供相同的可视化,我通常不会将JavaDoc看作HTML页面,而是将源文件导入到我的IDE中,以便它可以生成JavaDoc弹出窗口,我可以跳转到定义。这比Doxygen提供的功能更强大。如果您希望在IDE之外拥有文档,并且很乐意运行非Java工具,那么Doxygen值得一试,因为它不需要对您的Java代码进行任何更改。
I just realized from an article in CACM that Doxygen works with Java (and several other languages) too. But Java has already the Javadoc tool. Can someone explain what are the pros and cons of either approach? Are they mutually exclusive? Is there a Maven plugin for Doxygen?
Doxygen has a number of features that JavaDoc does not offer, e.g. the class diagrams for the hierarchies and the cooperation context, more summary pages, optional source-code browsing (cross-linked with the documentation), additional tag support such as @todo on a separate page and it can generate output in TeX and PDF format.It also allows a lot of visual customization.
Since Doxygen supports the standard JavaDoc tags you can run Doxygen on any source code with JavaDoc comments on it. It often can even make sense to run on source code without JavaDoc since the diagrams and source code browsing can help understanding code even without the documentation. And since the JavaDoc tool ignores unknown tags you can even use additional Doxygen tags without breaking JavaDoc generation.
Having said all this I must admit that I haven't used Doxygen for a long time. I tend to rely heavily on my IDE nowadays to provide the same visualization and I usually don't read JavaDoc as HTML pages but import the source files into my IDE so it can generate JavaDoc flyouts and I can jump to the definitions. That's even more powerful than what Doxygen has to offer. If you want to have documentation outside the IDE and are happy to run non-Java tooling then Doxygen is worth a try since it doesn't require any change to your Java code.
这篇关于Doxygen vs Javadoc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!