1

我想build.xml通过向我的目标添加 checkstyle 来改进我的文件。

我添加checkstyle-5.5-all.jar到我的lib文件夹中。我还添加了一个包含checkstyle_checks.xml.

到目前为止,我有这个:

<taskdef resource="${lib.dir}" classpathref="checkstyle.classpath"/>
<checkstyle config="checkstyle/checkstyle_checks.xml" classpath="${lib}/checkstyle-5.5-all.jar">
    <formatter type="xml" tofile="${checkstyle}/checkstyle_error.xml"/>
    <fileset dir="${src}" includes="${src}"/>
</checkstyle> 

我收到此错误:

Could not load definitions from resource lib. It could not be found.

就是这一行:

<checkstyle config="checkstyle/checkstyle_checks.xml" classpath="${lib}/checkstyle-5.5-all.jar">

我错过了什么?

4

1 回答 1

0

根据checkstyle 文档资源参数必须是属性文件,而不是您的 lib 目录:

<taskdef resource="checkstyletask.properties"
         classpathref="checkstyle.classpath"/>
于 2012-03-02T13:52:06.483 回答