java 读写doc maven_Java API核心类的maven-javadoc-plugin和inheritDoc

这是预期的,javadoc只复制来自源路径内的类的注释.从

Method Comment Inheritance开始:

Note: The source file for an inherited method must be on the path specified by the -sourcepath option for the documentation comment to be available to copy. Neither the class nor its package needs to be passed in on the command line. This contrasts with Release 1.3.n and earlier releases, where the class had to be a documented class.

Inheriting Comments from J2SE – Your code can also automatically inherit comments from interfaces and classes in the J2SE. You can do this by unzipping the src.zip file that ships with the SDK (it does not contain all source files, however), and add its path to -sourcepath. When javadoc runs on your code, it will load the doc comments from those source files as needed. For example, if a class in your code implements java.lang.Comparable, the compareTo(Object) method you implement will inherit the doc comment from java.lang.Comparable.

所以,要使它工作:

>找到JDK的源代码并将其解压缩到某处.

>配置maven-javadoc-plugin以使用sourcepath参数添加这些源.

>通过上面的内容,我们还将生成JDK本身的Javadoc,这是不必要的(我们只想继承),因此我们可以使用subpackages来仅指定我们的包.或者,我们可以使用excludePackageNames来排除JDK包.

> JDK(至少Oracle JDK)也使用新的Javadoc条目,即@ apiNote,@ implSpec和@implNote.这些是需要使用tags参数添加的自定义标记.

这是一个示例配置,其中JDK源的路径是/ path / to / jdk / sources(您还可以使用环境变量,由配置文件设置的属性等),并且您自己的源文件都在我的包中.包:

org.apache.maven.plugins

maven-javadoc-plugin

2.10.1

/path/to/jdk/sources:${basedir}/src/main/java

my.package

apiNote

a

implSpec

a

implNote

a

生成Javadoc,例如使用mvn javadoc:javadoc,将正确解析{@inheritDoc}.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值