Where to put java package-level information to use by javadoc?

℡╲_俬逩灬. 提交于 2020-01-03 13:04:13

问题


Some API docs contain information at package level. For example java.io contains 3 package-level sections here http://docs.oracle.com/javase/7/docs/api/java/io/package-summary.html

The sections are: "Package java.io Description", "Package Specification" and "Related Documentation".

Where should I put these sections content in my own project so that javadoc processes it in the same way?


回答1:


create a file called package-info.java in each package

inside do the following

/**
 * Javadoc
 */
package my.cool.package123;



回答2:


You put those comments in a package comment file (emphasis mine):

Each package can have its own documentation comment, contained in its own "source" file, that the Javadoc tool will merge into the package summary page that it generates. You typically include in this comment any documentation that applies to the entire package.

To create a package comment file, you have a choice of two files to place your comments:

  • package-info.java - Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is generally preferred over package.html .
  • package.html - Can contain only package comments and Javadoc tags, no package annotations.



回答3:


You have to put a file called package-info.java into the folder that contains your package.



来源:https://stackoverflow.com/questions/12898270/where-to-put-java-package-level-information-to-use-by-javadoc

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