【问题标题】:mvn checkstyle:checkstyle uses wrong configuration when using reportingmvn checkstyle:checkstyle 在使用报告时使用了错误的配置
【发布时间】:2015-05-26 19:24:03
【问题描述】:

我面临以下问题。我已经使用以下配置设置了我的检查样式:

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>${checkstyle.plugin.version}</version>
            <inherited/>
            <configuration>
                <configLocation>${basedir}/checkstyle.xml</configLocation>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
            </configuration>
        </plugin>
    </plugins>
</reporting>

当我运行mvn site 时,它运行良好。但是,当我通过mvn checkstyle:checkstyle 运行 checkstyle 以更有效地获取 XML 报告时,checkstyle 插件无法使用默认配置。当我将插件移动到&lt;build&gt; 时,XML 会正确生成,但现在生成的站点中不再包含 checkstyle 报告。

将报告插件设置为 Checkstyle 的(当前)方式是什么,同时保留在相同配置下单独运行插件的能力?

这真的是定义插件和配置两次的首选方式吗?

【问题讨论】:

  • 您使用的是哪个版本的 Checkstyle?
  • maven-checkstyle-plugin:2.15。在这里我找到了不满意的答案:github.com/sevntu-checkstyle/checkstyle-samples/blob/master/…
  • 感谢分享解决方案。请也将其发布为答案。
  • 这不是解决方案而不是解决方案吗?我个人会期望不同的行为?为什么不能使用正确的配置单独运行报告插件?

标签: java maven checkstyle


【解决方案1】:

好的,显然您应该将带有配置的插件添加到&lt;build&gt;&lt;reporting&gt;

【讨论】:

    猜你喜欢
    • 2012-09-08
    • 2019-05-13
    • 1970-01-01
    • 2020-03-27
    • 2015-07-17
    • 1970-01-01
    • 2017-06-27
    • 1970-01-01
    • 2014-11-21
    相关资源
    最近更新 更多