我是新來的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