Personal tools
You are here: Home Maven Notes Maven2 and Checkstyle
Document Actions

Maven2 and Checkstyle

by MIYACHI Yasuhiko last modified 2006-06-22 16:12

 Maven2で開発時に、Checkstyleを利用する方法。

# 後でsourceを見る他人(1ヶ月後の自分を含む...)のために、


注意

 Localのcheckstyle.xmlを利用するため、maven-checkstyle-pluginは、現在の2.0-bera-1ではなく、SVNで取得したsourceから、2.0-beta-2-SNAPSHOTをmvn install して利用しています。
 また、Site構築時でなく、開発時に利用するため、reports cycleではなく、build cycleに組み込んでいます。


pom.xml

 <build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<consoleOutput>true</consoleOutput> <- Errorをconsoleに表示させるため
<!--
for 2.2-beta-1
<format>sun</format>
-->
<!-- for 2.2-beta-2 -->
<configLocation>${user.home}/checkstyle.xml</configLocation>
</configuration>
</plugin>
...
</plugins>
</build>


checkstyle.xml

 checkstyle.xmlは、Checkstyleのbinaryにあるsun_check.xmlを基にして、作成します。


実行方法

$mvn checkstyle:checkstyle
...

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: