【问题标题】:Checkstyle: Results file not being generated.Checkstyle:未生成结果文件。
【发布时间】:2012-01-22 07:56:39
【问题描述】:

我在一个 ANT 任务中运行 checkstyle

<taskdef resource="checkstyletask.properties" classpath="checkstyle-5.5//checkstyle-5.5-all.jar"/> 
<checkstyle config="checkstyle-5.5/sun_checks.xml" failOnViolation="false">
  <fileset dir="src/net" includes="**/*.java"/>
</checkstyle>

无论如何,checkstyle 肯定在运行;我在控制台上看到了大量的输出。但是,我没有看到 checkstyle-results.xml 文件作为输出。

当然,我假设这是一个严重错误,并且默认情况下,在 checkstyle 运行时总是会生成 checkstyle-results.xml。那是对的吗?我相信 Jenkins 或 Hudson CI 插件也需要 results.xml 文件。

【问题讨论】:

  • -1:通过谷歌搜索“checkstyle ant task”并单击第一个结果,我花了 2 秒时间找到答案。
  • 是的 - 出于某种原因,“嵌套元素”标题让我失望。无论如何-您的答案是正确的。谢谢

标签: java ant checkstyle


【解决方案1】:

您需要在格式化程序元素中指定输出;默认情况下它转到标准输出。

http://checkstyle.sourceforge.net/anttask.html

【讨论】:

    【解决方案2】:

    来自http://checkstyle.sourceforge.net/anttask.html

    此任务支持嵌套元素文件集、类路径、 格式化程序和属性。

    formatter 元素的参数为:

    输入

    要生成的输出类型。有效值为:

    plain - specifies the DefaultLogger
    xml - specifies the XMLLogger
    

    默认为“普通”。没有

    toFile 将输出写入的文件。默认值 到标准输出。注意,没有办法明确指定 标准输出。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-12
      • 1970-01-01
      • 2023-02-17
      • 2018-09-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-04
      • 1970-01-01
      相关资源
      最近更新 更多