我希望通过向目标添加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">
我错过了什么?
答案 0 :(得分:0)
根据checkstyle documentation,resource parameter必须是属性文件,而不是你的lib目录:
<taskdef resource="checkstyletask.properties"
classpathref="checkstyle.classpath"/>