netbeans中的checkstyle插件,用于生成约定违规的build.xml目标规范

时间:2012-03-02 12:49:00

标签: java plugins netbeans checkstyle build.xml

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

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

到目前为止,我有这个:

    

<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">

我错过了什么?

1 个答案:

答案 0 :(得分:0)

根据checkstyle documentationresource parameter必须是属性文件,而不是你的lib目录:

<taskdef resource="checkstyletask.properties"
         classpathref="checkstyle.classpath"/>