在Jenkins中发布checkstyle报告

时间:2012-09-25 21:43:08

标签: ant jenkins warnings static-analysis checkstyle

我有以下问题 - 我在使用Jenkins构建时运行了一个checkstyle ant任务,并且相应的报告已经生成,但事情是,当构建完成时,我收到一条消息,表明在此过程中出现了错误解析因为找不到错误报告。我确认我已经设置了要发布到正确的报告的路径(当我将其更改为稍微不同的东西时,我得到一条消息,即xxx不存在,但前一版本的路径确实存在)。知道什么可能是错的吗? Jenkins期望发布checkstyle报告的格式是什么?我正在使用以下build.xml

 <taskdef
    classpath="libs/checkstyle-5.6-all.jar"
    resource="checkstyletask.properties" />

 <target name="checkstyle" >

        <checkstyle
            config="checkstyle.xml"
            failOnViolation="false" >

            <fileset
                dir="src"
                includes="**/*.java" />

            <formatter type="plain" />

            <formatter type="xml" />

            <formatter
                toFile="checkstyle-result.xml"
                type="xml" />
        </checkstyle>

        <style
            style="checkstyle-noframes.xsl"
            in="checkstyle-result.xml"
            out="checkstyle-result.html" />
    </target>

配置是sun-checkstyle配置。

感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

尝试在Jenkins作业配置中指定** / checkstyle-result.xml作为结果文件位置;这将查看整个构建工作区的结果文件。一旦你有工作,你可以收紧文件glob。

如果以上操作无效,请发布您从Jenkins获取的错误消息以及checkstyle-results.xml相对于作业工作空间目录的位置。

答案 1 :(得分:1)

来自checkstyle plugin website

  

Checkstyle插件扫描中的checkstyle-result.xml文件   构建工作区并报告找到的警告数量。

插件应该查找checkstyle-result.xml XML格式的文件。您没有在问题中提及您是如何配置插件的,但如果您正在寻找可能是问题的checkstyle-result.html。