Maven Blame Plugin – Add developper info in checkstyle/pmd/findbugs reports
Checkstyle/Pmd/Findbugs are good tools to test quality of your java code but you don’t know in your team who respects code standing rules and who does not. Maven Blame Plugin allows you to have that kind of informations. For each code rule violation, it queries your subversion repository to have the last commiter of the corresponding line code.
Maven Blame Plugin does 2 things :
- It updates the checkstyle/pmd/findbugs xml reports : it adds an attribute @author on each code vilolations. External tools can use this new attribute to improve their reports.
- It generates a blame report with some global statistics about developpers.
To use the maven blame plugin, you have to change the pom.xml of your project.
First, declare the codehaus snapshot repository :
<pluginRepositories>
<pluginRepository>
<id>codehaus-snapshot</id>
<name>Snapshot codehaus repository</name>
<url>http://snapshots.repository.codehaus.org</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Then, add the different reports(checkstyle,pmd,findbugs) with at the end, the blame one :
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.maven-blame-plugin</groupId>
<artifactId>maven-blame-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<enableCheckstyle>true</enableCheckstyle>
<enablePmd>false</enablePmd>
<enableFindBugs>false</enableFindBugs>
<fullBlame>true</fullBlame>
</configuration>
</plugin>
</plugins>
</reporting>
Endly, launch the site generation :
mvn site
Maven Blame connects to your svn repository and it may need to authenticate. Authentication information can be indicated via maven properties : maven.scm.username and maven.scm.password.
For more informations :
Maven Blame Plugin Web Site
Example of blame report
Example of checkstyle report xml file
Comments
Leave a Reply