Available PluginsのReporting pluginsにいろいろなプラグインがのっているので、使えそうなレポートを出してみる。
changelog
・Maven Changelog Plugin
pom.xmlに以下のように記述。
<project> <scm> <connection>scm:svn:http://server/path/to/project/trunk</connection> <developerConnection>scm:svn:https://server/path/to/project/trunk</developerConnection> <url>scm:svn:http://server/path/to/view/trunk</url> </scm> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changelog-plugin</artifactId> </plugin> </plugins> </reporting> </project>
SVNコマンドが見つからないというエラーが出たので、クライアントをいれないとだめなのかも。またこんど。
こんなかんじにSVNのログレポートが出せる。
changes
・Maven 2 Changes Plugin
まだつかってない。Usageに使い方が書いてる。
こんなかんじで変更履歴が残せるぽい。リリースノートのプラグイン版かな。
checkstyle
・Maven 2 Checkstyle Plugin
CheckStyleの結果がレポートされる。pom.xmlは以下。
<project> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <configuration> <encoding>UTF-8</encoding> <configLocation>src/main/config/sun_check_light.xml</configLocation> </configuration> </plugin> </plugins> </reporting> </project>
Checkstyle Resultsのようなレポートになる。
configLocationでオリジナルの定義ファイルを使える。Using a Custom Checkstyle Checker Configurationに「URL, File, or build classpath resource reference」とかあるのでローカルパス以外もいろいろ設定可能。
clover
商用らしいのでパス。カバレッジレポートらしい。
doap
「Generate a Description of a Project (DOAP) file from a POM.」らしい。よくわからんのでパス。
docck
ドキュメントのチェックをしてくれるらしい。
javadoc
・Maven 2 Javadoc Plugin
Maven2.0.9 – Javadocを作ってみる参考のこと。
jxr
・Maven 2 JXR Plugin
これは便利。ソースコードをHTMLにしてくれるので、Javadocと連携してソースコードを確認できる。Web上でこれができるのは便利。
<project> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> </plugin> </plugins> </reporting> </project>
こんなかんじでJavadocぽくソースを確認できる。メインのソースはJavadocにリンクしてくれるが、Testのクラスはリンクしてくれない。設定がないのでできないのかも。
pmd
・Maven 2 PMD Plugin
PMDはソースコード状の問題という意味らしい。あとCPDというCopy/Pasteの場所を検出してレポートしてくれる。
<project> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>2.3</version> <configuration> <linkXref>true</linkXref> <sourceEncoding>utf-8</sourceEncoding> <minimumTokens>100</minimumTokens> <targetJdk>1.5</targetJdk> <!-- <excludes> <exclude>**/*Bean.java</exclude> <exclude>**/generated/*.java</exclude> </excludes> <excludeRoots> <excludeRoot>target/generated-sources/stubs</excludeRoot> </excludeRoots> --> </configuration> </plugin> </plugins> </reporting> </project>
PMD ResultsやCPD Resultsのようになる。
project-info-reports
・Maven Project Info Reports Plugin
Project Informationを出力してくれる。設定しなくてもsiteでゴールすれば、デフォルトで出力されるので
以下のように設定して、出力を制御することも可能。
<project> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <reportSets> <reportSet> <reports> <report>plugin-management</report> <report>plugins</report> <report>source-repository</report> <report>project-summary</report> <report>project-team</report> <!--<report>license</report>--> <report>mailing-list</report> <report>dependencies</report> <report>issue-tracking</report> <!--<report>integration</report>--> <report>cim</report> <report>scm</report> </reports> </reportSet> </reportSets> </plugin> </plugins> </reporting> </project>
surefire-report
・Maven Surefire Report Plugin
単体テストの結果レポート。JUnitのテスト結果となる。
<project> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.4.2</version> </plugin> </plugins> </reporting> </project>
結果はSurefire Reportのようなレポートになる。
Cobertura Maven Plugin
・Cobertura Maven Plugin
カバレッジレポートをだしてくれる。
<project> <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> </plugin> </plugins> </reporting> </project>
Cobertura Test Coverageのようなレポートになる。なかなか素敵。
その他
Maven本家に書かれていないものも結構あるみたい。