Maven Project Raports
Comments: 2Thanks to maven, all Project I’m involved in can have the same reports. I will describe which reports I’m using and way.
Findbugs report, in my opinion is one of the most important reports. Here you find my config. Version 2.0 is in snapshot repository and I suppose it will be release in nearly future. This report provide as information about static analyses problems. I use it to discover common mistakes, and i configure it to Normal level which is ok to begin work with findbugs.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<threshold>Normal</threshold>
<effort>Max</effort>
</configuration>
</plugin>
Surefire & Cobertura
Next must to have duet is surfire plugin with cobertura. First one serves us test report (about execution) the second one serves us information about code coverage. The config looks like this. This duet runs test and provides report from them and code coverage information comes from cobertura.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
This duet search duplicated code, and report it. If you want to be DRY, you should use this.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<targetJdk>1.5</targetJdk>
</configuration>
</plugin>
Checkstyle provides information about code style violation, I use it with own setting because in my opinion 80 character line for today screens is not so wise decision. And of course I can tune some of checkers.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
This one provides information about dependencies in our code, so we can improve design. It also provides us some code metrics, which we can use to plan some refactoring.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
</plugin>
Cross reference source generators used by other plugins to make links between raport and the code.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
Tag list plugin will keep all configured tags in one beautiful list.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
<configuration>
<tags>
<tag>TODO</tag>
<tag>FIXME</tag>
<tag>@todo</tag>
<tag>@deprecated</tag>
</tags>
</configuration>
</plugin>
As everybody knows we should write javadocs, and if we … blah blah. Javadoc is ok, but what about javadoc and UML, you can do it. Simply add uml doclet config. Note that you must have UmlGraph installed. You find here more information.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<reportSets>
<reportSet>
<id>html</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
<reportSet>
<id>doccheck</id>
<configuration>
<doclet>gr.spinellis.umlgraph.doclet.UmlGraph</doclet>
<docletArtifact>
<groupId>gr.spinellis.umlgraph</groupId>
<artifactId>umlgraph</artifactId>
<version>4.6</version>
</docletArtifact>
<additionalparam>-attributes</additionalparam>
<additionalparam>-enumerations</additionalparam>
<additionalparam>-enumconstants</additionalparam>
<additionalparam>-operations</additionalparam>
<additionalparam>-qualify</additionalparam>
<additionalparam>-types</additionalparam>
<additionalparam>-visibility</additionalparam>
<additionalparam>
-d ${project.build.directory}/site/doccheck
</additionalparam>
<destDir>doccheck</destDir>
<name>DocCheck</name>
<description>DocCheck documentation.</description>
</configuration>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
Info from our SCM repository.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changelog-plugin</artifactId>
</plugin>
There is also project report with information about developer, scm and so on.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>cim</report>
<report>dependencies</report>
<report>issue-tracking</report>
<report>index</report>
<report>summary</report>
<report>scm</report>
<report>project-team</report>
</reports>
</reportSet>
</reportSets>
</plugin>
Do you use another reporting plugin? Fill free to share it into comments.
Bye
Comments
pedro
No I haven’t used it, but I try it. Also I found nice source measurement plugin: javancss-maven-plugin.
Brush
Nice post Seba. Have you checked Simian? http://www.redhillconsulting.com.au/products/simian/ It’s commercial if you use if “for profit” but was a nice one last time i’ve checked. How does ir compare to CPD?