我是新来的maven和checkstyle所以请礼貌:)。如何停止使用checkstyle maven构建使用checkstyle
我设法使用maven checkstyle插件,我可以创建我的代码报告。但是我真正想要的是,如果样式检查有任何错误,我可以停止maven的构建过程。
到目前为止,我的pom.xml看起来象下面这样:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>my-app</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<scope>compile</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.8</version>
</plugin>
</plugins>
</reporting>
</project>
我怎么能在这里实现我的目标是什么?我们的团队希望有严格的编码风格标准,所以我必须使用它。
thnx man,有没有办法将结果打印到命令行,而不是写入xml文件? – LostMohican 2012-02-02 14:17:46
@LostMohican:是的,您可以将' true consoleOutput>'添加到配置部分以启用控制台输出。要获得更多选项,你可以看看那里:http://maven.apache.org/plugins/maven-checkstyle-plugin/check-mojo.html –
2012-02-02 15:10:37