【发布时间】:2014-02-08 10:17:21
【问题描述】:
如果“checkstyle”检测到任何错误,我希望构建失败。 我提到了how to stop maven build using checkstyle 和https://maven.apache.org/plugins/maven-checkstyle-plugin/usage.html。我的 pom.xml 看起来像这样:
<build>
<pluginManagement>
<plugins>
.....
.....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.11</version>
<executions>
<execution>
<id>validate</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
<configuration>
<configLocation>config/sun_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
运行 checkstyle:check 会报告源代码中的错误。但是运行安装成功。我已经尝试将插件绑定到验证、处理源和其他阶段。但是构建总是成功的。我是否缺少一些配置?
【问题讨论】:
标签: maven checkstyle