【发布时间】: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 插件无法使用默认配置。当我将插件移动到<build> 时,XML 会正确生成,但现在生成的站点中不再包含 checkstyle 报告。
将报告插件设置为 Checkstyle 的(当前)方式是什么,同时保留在相同配置下单独运行插件的能力?
这真的是定义插件和配置两次的首选方式吗?
【问题讨论】:
-
您使用的是哪个版本的 Checkstyle?
-
maven-checkstyle-plugin:2.15。在这里我找到了不满意的答案:github.com/sevntu-checkstyle/checkstyle-samples/blob/master/…
-
感谢分享解决方案。请也将其发布为答案。
-
这不是解决方案而不是解决方案吗?我个人会期望不同的行为?为什么不能使用正确的配置单独运行报告插件?
标签: java maven checkstyle