如何在 Hudson 中为 Ant 配置 checkstyle?
如何配置 checkstyle(在 Ant nt Maven 中)任务?我尝试了一点,但没有正确收到报告。这是我的蚂蚁脚本。
<target name="checkStyle">
<taskdef resource="checkstyletask.properties">
<classpath refid="compile.class.pathtest"/>
</taskdef>
<checkstyle config="${source.code.dir}/config/sun_checks.xml">
<fileset dir="${base.working.dir}/JavaFolder">
<include name="**/*.java"/>
</fileset>
<formatter type="plain"/>
<formatter type="xml" toFile="checkstyle-result.xml"/>
</checkstyle>
</target>
<path id="compile.class.pathtest">
<pathelement location="${checkstyle.dir}/checkstyle-5.5-all.jar"/>
<pathelement location="${checkstyle.dir}/checkstyle-5.5.jar"/>
<pathelement location="${checkstyle.dir}/pmd-3.9.jar"/>
<pathelement location="${checkstyle.dir}/asm-3.0.jar"/>
<pathelement location="${checkstyle.dir}/backport-util-concurrent-2.1.jar"/>
<pathelement location="${checkstyle.dir}/jaxen-1.1-beta-10.jar"/>
<pathelement location="${checkstyle.dir}/saxpath-1.0-FCS.jar"/>
</path>
sun_checks.xml 文件是什么?我已经下载并保存在上述文件夹中。运行构建时,它会显示一些警告和错误。后来就显示成这样了。
构建失败
C:\server\build.xml:9725:执行此行时发生以下错误: C:\server\build.xml:3838:有 56 个错误和 27599 个警告。
你能指导我如何解决这个问题吗?
谢谢
How can I configure checkstyle (in Ant nt Maven) task? I tried little bit but I didn't get the reports properly. Here's my ant script.
<target name="checkStyle">
<taskdef resource="checkstyletask.properties">
<classpath refid="compile.class.pathtest"/>
</taskdef>
<checkstyle config="${source.code.dir}/config/sun_checks.xml">
<fileset dir="${base.working.dir}/JavaFolder">
<include name="**/*.java"/>
</fileset>
<formatter type="plain"/>
<formatter type="xml" toFile="checkstyle-result.xml"/>
</checkstyle>
</target>
<path id="compile.class.pathtest">
<pathelement location="${checkstyle.dir}/checkstyle-5.5-all.jar"/>
<pathelement location="${checkstyle.dir}/checkstyle-5.5.jar"/>
<pathelement location="${checkstyle.dir}/pmd-3.9.jar"/>
<pathelement location="${checkstyle.dir}/asm-3.0.jar"/>
<pathelement location="${checkstyle.dir}/backport-util-concurrent-2.1.jar"/>
<pathelement location="${checkstyle.dir}/jaxen-1.1-beta-10.jar"/>
<pathelement location="${checkstyle.dir}/saxpath-1.0-FCS.jar"/>
</path>
What's that sun_checks.xml file? I have downloaded and kept in the above mentioned folder. While running the build, it shows some warnings and errors. Later, it shows like this.
BUILD FAILED
C:\server\build.xml:9725: The following error occurred while executing this line:
C:\server\build.xml:3838: Got 56 errors and 27599 warnings.
Can you please guide me how to solve this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
sun_checks.xml
文件包含 checkstyle 配置,即所有规则在评估源代码时应该应用。您的构建失败,因为 checkstyle 发现错误。
您可以将 failOnViolation 属性设置为 false 以避免出现这种情况。如果未设置,此属性默认为 true。
The
sun_checks.xml
file contains the checkstyle configurations, i.e. all rules that should be applied when evaluating your source code.Your build failes, because checkstyle found error.
You can set the failOnViolation property to false to avoid this. This property defaults to true, when it is not set.