使用Ant

时间:2015-09-18 01:26:16

标签: eclipse ant java-8 javadoc eclipse-mars

我最近将我的开发环境从Java 7升级到Java 8,现在发现了大量以前未检测到的 javadoc 问题。

默认情况下,Ant(通过Eclipse Mars调用)将其警告(我假设错误)限制为100:

Ant warnings limited to 100

是否有任何参数可强制Ant显示所有 javadoc 警告而不是限制为100?

我尝试通过-Xmaxwarns 1000元素使用compilerarg参数,但似乎Eclipse Mars(Ant 1.9.4)javadoc task中的当前Ant版本不支持{ {1}}元素(仅在javac task中支持):

compilerarg

ant: javadoc doesn't support the nested "compilerarg" element.

Java 8 <!-- 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 7 b100中添加了支持):

javadoc

结论:Ant 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. 任务似乎是限制因素,如果它支持javadoc标志,则可以调整限制错误和警告。

1 个答案:

答案 0 :(得分:5)

如您所述,-Xmaxwarns会影响javadoc计划输出的警告数量。

-Xmaxwarns可以使用嵌套的javadoc元素传递到<arg>程序:

<javadoc ...>
    <arg value="-Xmaxwarns"/>
    <arg value="200"/>
</javadoc>

在我自己的测试案例中,我能够将报告的警告增加到100以上:

[javadoc] Generating Javadoc
...
[javadoc] 112 warnings