val*_*tis 5 eclipse ant javadoc java-8 eclipse-mars
我最近将我的开发环境从Java 7升级到Java 8,现在发现了大量以前未检测到的javadoc问题.
默认情况下,Ant(通过Eclipse Mars调用)将其警告(我假设错误)限制为100:

是否有任何参数强制Ant显示所有 javadoc警告而不是限制为100?
我试图-Xmaxwarns 1000通过compilerarg元素使用参数,但似乎Eclipse Mars(Ant 1.9.4)javadoc任务中的当前Ant版本不支持该compilerarg元素(它仅在javac任务中受支持):
<!-- 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>
...
Run Code Online (Sandbox Code Playgroud)

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.
Run Code Online (Sandbox Code Playgroud)
结论: Ant javadoc任务似乎是限制因素,如果它支持该compilerarg标志,则可以调整错误和警告的限制.
如您所述,-Xmaxwarns会影响javadoc程序输出的警告数量.
-Xmaxwarns可以javadoc使用嵌套<arg>元素传递给程序:
<javadoc ...>
<arg value="-Xmaxwarns"/>
<arg value="200"/>
</javadoc>
Run Code Online (Sandbox Code Playgroud)
在我自己的测试用例中,我能够将报告的警告增加到100以上:
[javadoc] Generating Javadoc
...
[javadoc] 112 warnings
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
997 次 |
| 最近记录: |