Why might javadoc be failing to generate a page for a particular class?

时间:2018-04-18 18:09:20

标签: javadoc

I have a project with a handful of packages and classes in it.

When running javadoc against the project (using Apache ant's task), I believe every class is being documented except for the one I happen to be working on, now.

The class does not appear in the "All Classes" frame. The class does not appear in either of the "Package" frames. There are no files on the disk with the same name as the class (which of course all other classes have).

Some things I've checked:

  1. Other classes in the same package are being documented, so this class isn't being "excluded" due to its package.

  2. The class is public, so it's not being hidden due to a visibility issue.

  3. The source file does in fact contain correct /** javadoc-style comments at the class level as well as for some constructors and member methods.

  4. When running javadoc -verbose, I can see the source file is being loaded: [javadoc] [parsing started RegularFileObject[/full/path/to/Source.java]] [javadoc] [parsing completed 6ms]

  5. No errors are being emitted for this class (there are warnings and errors for other source files, but not this one).

  6. I have not run out of disk space.

Any ideas for how to get more information from javadoc or to see why this class might be ignored?

2 个答案:

答案 0 :(得分:1)

事实证明,这是一个愚蠢的错误。

真正的问题是我向javadoc传递了一个无效的参数,由于我使用了Apache Ant,它有点隐藏了:

javadoc -source '${src.spec}' ...

我的基于ant的构建脚本正在向命令行添加无效的-source值。 Javadoc正在进行动作,但实际上并没有生成任何文件。也没有发生任何错误。 :(

第二个问题是我的构建脚本中的clean目标是而不是删除旧的javadoc文件,因此运行ant clean javadoc在磁盘上没有任何变化。重新加载“生成的”javadoc实际上只是浏览过去很久就生成的API文档。我的新课程不是那个课程的一部分,所以它没有出现。

-source参数修复为javadoc让事情再次发挥作用。

答案 1 :(得分:0)

抱歉,我没有足够的声誉发表评论。您是否尝试过使用Netbeans“Analyze javadoc”功能?它贯穿整个项目,向您展示可能出现问题的地方,甚至建议修复。它可以在

找到
  

工具>>分析javadoc

选择项目时。

修改

您是否在类中没有任何未针对javadoc注释的公共方法?如果没有,则可能无法识别该类需要添加到文档中,因为那里没有任何内容。