今天需要把写过的代码导出一份doc来,使用eclipse.本来以为很就简单,但是还是出现了一些问题,这里把解决方法记下:
首先是乱码,这个没有问题,一搜一大堆.-encoding UTF-8 -charset UTF-8
再就是项目比较大时,导出到后来会oom,这个需要配置JVM参数,但是和java参数稍微有点不同,如-J-Xmx512m -J-Xms512m.
最后就是一大堆的警告,意思就是自己定义的标签如@公司 无法处理,这个需要配置javadoc的参数,格式大概是这样
-tag XXX:y:"ZZZ:" XXX就是@后到第一个空格之间的内容.y是使用范围,
官方上有以下解释
Placement of tags - The Xaoptcmf part of the argument determines where in the source code the tag is allowed to be placed, and whether the tag can be disabled (using X). You can supply either a, to allow the tag in all places, or any combination of the other letters:
X (disable tag )
a (all)
o (overview)
p (packages)
t (types, that is classes and interfaces)
c (constructors)
m (methods)
f (fields)
一般我们都是用a简单,ZZZ是在doc结果中显示值.例子如:-tag 公司.:a:"公司:",注意,公司后有一点,之所以这样,是不用点,javadoc会出现提示,大意是说sun可能会将这些标签变为官方标签,建议自定义的标签加个.以示区别.
所以全部参数应该为:
-encoding UTF-8 -charset UTF-8 -tag 作者.:a:"作者:" -tag 负责人.:a:"负责人:" -tag 公司.:a:"公司:" -tag 负责人公司.:a:"公司:" -tag 修改.:a:"修改人:" -tag 日期.:a:"日期:"
这样子,对应文档中
/**
*
* @作者. <a href="http://i2534.iteye.com">i2534</a>
* @负责人. <a href="http://i2534.iteye.com">i2534</a>
* @公司. javaeye
* @日期. ${date} ${time}
*
*/