gpt4 book ai didi

ant - 如何在 Hudson 中为 Ant 配置 checkstyle 配置?

转载 作者:行者123 更新时间:2023-12-02 01:29:36 28 4
gpt4 key购买 nike

如何配置 checkstyle(在 Ant nt Maven 中)任务?我尝试了一点,但没有正确收到报告。这是我的 Ant 脚本。

<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 个警告。

您能指导我如何解决这个问题吗?

谢谢

最佳答案

sun_checks.xml 文件包含 checkstyle configurations ,即评估源代码时应应用的所有规则。

您的构建失败,因为 checkstyle 发现错误。

您可以设置 failOnViolation属性设置为 false 可以避免这种情况。如果未设置此属性,则默认为 true。

<checkstyle config="${source.code.dir}/config/sun_checks.xml" failOnViolation="false">
<fileset dir="${base.working.dir}/JavaFolder">
<include name="**/*.java"/>
</fileset>
<formatter type="plain"/>
<formatter type="xml" toFile="checkstyle-result.xml"/>
</checkstyle>

关于ant - 如何在 Hudson 中为 Ant 配置 checkstyle 配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8222649/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com