Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services

Technology

Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.

Resources

Chariot Conferences

Podcasts

« Wednesday / Thursday Quizzo - flowin' it | Main | Quizzo repo public »
Tuesday
Feb212012

Monday/Tuesday Quizzo - It's a mess w/a silver lining?

What did I do over the last two days, beyond deal with proposals, our training website, and a number of other issues? Oh, yeah, right... I DID say I'd be working on the Quizzo too...

I did a few interesting things over the last few days. First off, let's talk about adding Maven reports.

The Maven Site Plugin

Ok, you're looking at Roo, and you realize it uses Maven. Ugh, you say (assuming you've not ever worked with Maven in the enterprise). No, not ugh. Awesome. Actually, as unexciting as the language of Maven is (XML), it can do a ton of work for you automatically.

We're going to configure a plugin called the maven site plugin. This plugin gives you reports on your project, such as code coverage, JavaDoc, and much more. To set it up, we'll first have to edit our pom.xml file, and add the following plugin definition BEFORE the end of the section:


<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.0</version>
    <configuration>
        <reportPlugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.2</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>2.4.0</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.3</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.11</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>failsafe-report-only</report>
                            <report>report-only</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </reportPlugins>
    </configuration>
    <executions>
        <execution>
            <id>attach-descriptor</id>
            <goals>
                <goal>attach-descriptor</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The reports being run via this setup include:

  • The Maven JavaDoc report
  • The standard project info reports (referenced in the report descriptor below)
  • The Cobertura code coverage engine. Shows teams how much code they are testing.
  • The Java Cross Reference report (anywhere source is listed, it will write hyperlinks and allow you to browse into the code.
  • Findbugs, a very interesting code analysis engine
  • Maven surefire report - which shows an overview of all JUnit tests executed by the run

Once we've set this up, we're all set to add a site descriptor to the project and deploy the site using the mvn site command. First, we create a src/site/site.xml descriptor, and load it with this information:


<?xml version="1.0" encoding="ISO-8859-1"?>

<project name="quizzo" xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0    
       http://maven.apache.org/xsd/decoration-1.0.0.xsd">
  <publishDate position="right" />
  <version position="right" />  
  <body>
    <menu ref="reports" inherit="top" />
  </body>
</project>

To generate our report site, we issue the mvn site command. This should download 1/2 of the internet the first time (lots of reporting engine APIs are being downloaded). Once finished, the site report will live in target/site and can be deployed via various mechanisms.

Browsing the Site Report

I've put a copy of my site report in a zip file for review. It's just a snapshot, but it gives you an idea of what you can expect.

Coming up tomorrow AM I'll highlight a few more changes we've made in the master trunk of our github repository. The Roo in Action final edits beckon me...

'Nite all.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>