【发布时间】:2015-12-15 00:54:48
【问题描述】:
我最近将我的开发环境从 Java 7 升级到 Java 8,现在发现了大量以前未检测到的 javadoc 问题。
默认情况下,Ant(通过 Eclipse Mars 调用)将其警告(我假设错误)限制为 100:
是否有任何参数可以强制 Ant 显示 all javadoc 警告而不是限制为 100?
我尝试通过compilerarg 元素使用-Xmaxwarns 1000 参数,但Eclipse Mars 中的当前Ant 版本(Ant 1.9.4)javadoc task 似乎不支持compilerarg 元素(它是仅支持javac task):
<!-- Generate the API documentation. -->
<target name="javadoc" depends="clean" description="Generate the API documentation.">
<!-- Create the build directory structure used by javadoc. -->
<mkdir dir="${build.folder}" />
<mkdir dir="${docs.folder}" />
<!-- Run javadoc. -->
<javadoc destdir="${docs.folder}/api" author="true" version="true" use="true" windowtitle="${documentation.title}">
<compilerarg value="-Xmaxerrs 1000 -Xmaxwarns 1000" />
<classpath>
...
Java 8 javadoc是否支持这些参数(Java 7 b100 中添加了支持):
C:\>javadoc -X
-Xmaxerrs <number> Set the maximum number of errors to print
-Xmaxwarns <number> Set the maximum number of warnings to print
Provided by standard doclet:
-Xdocrootparent <url> Replaces all appearances of @docRoot followed
by /.. in doc comments with <url>
-Xdoclint Enable recommended checks for problems in javadoc comments
-Xdoclint:(all|none|[-]<group>)
Enable or disable specific checks for problems in javadoc comments,
where <group> is one of accessibility, html, missing, reference, or syntax.
These options are non-standard and subject to change without notice.
结论: 看来Ant javadoc 任务是这里的限制因素,如果它支持compilerarg 标志,则可以调整错误和警告的限制。
【问题讨论】:
-
是 ant 还是 javadoc 限制了警告计数?你能从命令行运行 javadoc 吗?
-
@Seelenvirtuose 最终,javadoc 将警告消息限制为 100。我正在寻找一种在通过 Ant 启动 javadoc 时控制它的方法。
标签: eclipse ant java-8 javadoc eclipse-mars