Overview QALab for Maven 2

What are the significant steps for QALab?
    There are 3 Steps:
  1. Merge - It is a mandatory step, it takes statistics from different QA tools and insert a digest in qalab.xml
  2. Chart - Generates the QALab charts
  3. Movers - Creates the mover XML file given the correct parameters. The movers report shows what has changed over the last "x" hours/days.
[top]

What are the significant mojos?
    There are 3 Mojos provided for your use.
  1. BuildStatMergeMojo - Handles the merge of statistics into qalab.xml
  2. BuildStatChartMojo - Generates the QALab BuildStat chart
  3. BuildStatMoversMojo - Creates the mover XML file given the correct parameters. The movers report shows what has changed over the last "x" hours.
[top]

What is the easiest way to use QALab?

Assuming you have used the defaults for everything, put this in your POM et voila! You do not need to work on any build configuration.

This is the recommended option, and it works for single module POMs. Unfortunately, due to 2 bugs in Maven (http://jira.codehaus.org/browse/MSITE-188 and http://jira.codehaus.org/browse/MNG-1994) it does not work for Multi-module projects (see following question for a workaround).

<reporting>
 <plugins>
 ...         
  <plugin>
    <groupId>net.objectlab</groupId>
    <artifactId>mvn-qalab-plugin</artifactId>
    <version>2.2</version>
    <reportSets>
      <reportSet>
        <reports>
          <report>report-merge-chart</report>
          <report>report-movers-all</report>
       </reports>
     </reportSet>
   </reportSets>
 </plugin>
...
</plugins>
</reporting>  
[top]

What currently works with Multi-module projects?

Due to 2 bugs in Maven (http://jira.codehaus.org/browse/MSITE-188 and http://jira.codehaus.org/browse/MNG-1994), you need to specify the QA reports that generates the statistics required by QALab in the build sections of your POM.

It is recommended to use a PROFILE to specify all these settings that bind the reports at the VERIFY phase.


<profiles>
  <profile>
    <id>siteEnablement</id> 
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId> 
          <artifactId>maven-pmd-plugin</artifactId> 
          <executions>
            <execution>
              <id>verify_pmd</id> 
              <phase>verify</phase> 
              <goals>
                <goal>pmd</goal> 
             </goals>
              <configuration>
                <minimumTokens>20</minimumTokens> 
             </configuration>
           </execution>
         </executions>
       </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId> 
          <artifactId>cobertura-maven-plugin</artifactId> 
          <executions>
            <execution>
              <id>verify_cobertura</id> 
              <phase>verify</phase> 
              <goals>
                <goal>cobertura</goal> 
             </goals>
              <configuration>
                <formats>
                  <format>xml</format> 
                  <format>html</format> 
               </formats>
             </configuration>
           </execution>
         </executions>
       </plugin>
        
        <plugin>     
          <groupId>org.apache.maven.plugins</groupId> 
          <artifactId>maven-checkstyle-plugin</artifactId> 
          <executions>
            <execution>
              <id>verify_checkstyle</id> 
              <phase>verify</phase> 
              <goals>
                <goal>checkstyle</goal> 
             </goals>
           </execution>
         </executions>
       </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId> 
          <artifactId>findbugs-maven-plugin</artifactId> 
          <version>1.0-SNAPSHOT</version> 
          <executions>
            <execution>
              <id>verify_findbugs</id> 
              <phase>verify</phase> 
              <goals>
                <goal>findbugs</goal> 
             </goals>
              <configuration>
                <reportFormat>xml</reportFormat> 
             </configuration>
           </execution>
         </executions>
       </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId> 
          <artifactId>simian-report-maven-plugin</artifactId> 
          <version>1.0-SNAPSHOT</version> 
          <executions>
            <execution>
              <id>verify_simian</id> 
              <phase>verify</phase> 
              <goals>
                <goal>simian</goal> 
             </goals>
              <configuration>
                <minimumThreshold>2</minimumThreshold> 
             </configuration>
           </execution>
         </executions>
       </plugin>
     </plugins>
   </build>
  
    
    <reporting>
       <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId> 
             <artifactId>maven-surefire-report-plugin</artifactId> 
          </plugin>

           <plugin>
             <groupId>org.apache.maven.plugins</groupId> 
             <artifactId>maven-pmd-plugin</artifactId> 
             <configuration>
               <minimumTokens>20</minimumTokens> 
            </configuration>
         </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-javadoc-plugin</artifactId> 
            <configuration>
              <minmemory>128m</minmemory> 
              <maxmemory>512</maxmemory> 
           </configuration>
         </plugin>
     
          <plugin>
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-jxr-plugin</artifactId> 
         </plugin>
 
          <plugin>
            <groupId>org.codehaus.mojo</groupId> 
            <artifactId>cobertura-maven-plugin</artifactId> 
            <configuration>
              <formats>
                <format>xml</format> 
                <format>html</format> 
             </formats>
           </configuration>
        </plugin>     
  
         <plugin>
           <groupId>org.codehaus.mojo</groupId> 
           <artifactId>taglist-maven-plugin</artifactId> 
           <configuration>
             <tags>
               <tag>TODO</tag> 
               <tag>@todo</tag> 
            </tags>
          </configuration>
        </plugin>

         <plugin>
           <groupId>org.apache.maven.plugins</groupId> 
           <artifactId>maven-checkstyle-plugin</artifactId> 
        </plugin>

         <plugin>
           <groupId>org.codehaus.mojo</groupId> 
           <artifactId>findbugs-maven-plugin</artifactId> 
           <version>1.0-SNAPSHOT</version> 
        </plugin>

         <plugin>
           <groupId>org.codehaus.mojo</groupId> 
           <artifactId>simian-report-maven-plugin</artifactId> 
           <version>1.0-SNAPSHOT</version> 
           <configuration>
             <minimumThreshold>2</minimumThreshold> 
          </configuration>
        </plugin>

         <plugin>
           <groupId>net.objectlab</groupId> 
           <artifactId>mvn-qalab-plugin</artifactId> 
           <version>2.2</version> 
           <reportSets>
             <reportSet>
               <reports>
                 <report>report-merge-chart</report> 
                 <report>report-movers-all</report> 
              </reports>
            </reportSet>
         </reportSets>
          <configuration>
            <dateOnly>true</dateOnly> 
            <startTimeHoursOffset>1</startTimeHoursOffset> 
         </configuration>
       </plugin>
     </plugins>
   </reporting>
 </profile>
</profiles>
[top]

QALab Specific Goals for Maven 2

How do I use the MERGE task?

The easiest way you can configure the qalab mojos for Merge is as follows if you have accepted the default settings for the qa tools.

<build>
 <plugins>
...
  <plugin>
    <groupId>net.objectlab</groupId>
    <artifactId>mvn-qalab-plugin</artifactId>
    <version>2.2</version>
    <executions>
      <execution>
        <id>merge-all</id>
        <phase>site</phase>
        <goals>
          <goal>merge-all</goal>
       </goals>
     </execution>
   </executions>
 </plugin>
...
</plugins>
</build>
[top]

How do I configure the MERGE task?

You can configure a specific goal (like merge-checkstyle) or use the generic merge task. See the documentation for the valid configuration items.

<build>
 <plugins>
...
  <plugin>
    <groupId>net.objectlab</groupId>
    <artifactId>mvn-qalab-plugin</artifactId>
    <version>2.2</version>
    <executions>
      <execution>
        <id>merge</id>
        <phase>site</phase>
        <goals>
          <goal>merge</goal>
       </goals>
        <configuration>
          <handler>net.objectlab.qalab.parser.CheckstyleStatMerge</handler>
          <inputFile>${project.build.directory}/checkstyle/checkstyle-result.xml</inputFile>
       </configuration>
     </execution>
   </executions>
 </plugin>
...
</plugins>
</build>
[top]

How do I configure the Movers task?

Easy, add an execution:

<build>
 <plugins>
  <plugin>
    <groupId>net.objectlab</groupId>
    <artifactId>mvn-qalab-plugin</artifactId>
    <version>2.2</version>
    <executions>
...
      <execution>
        <id>qalab-movers</id>
        <phase>site</phase>
        <goals>
          <goal>movers</goal>
       </goals>
        <configuration>
          <startTimeHoursOffset>480</startTimeHoursOffset>
       </configuration>
     </execution>
   </executions>
 </plugin>
...
</plugins>
</build>
[top]

How do I configure the CHART task?

Easy, add an execution:

 <build>
 <plugins>
  <plugin>
    <groupId>net.objectlab</groupId>
    <artifactId>mvn-qalab-plugin</artifactId>
    <version>2.2</version>
    <executions>
  ...
      
      <execution>
        <id>qalab-chart</id>
        <phase>site</phase>
        <goals>
          <goal>chart</goal>
       </goals>
        <configuration>
          <summaryOnly>false</summaryOnly>
       </configuration>
     </execution>
  ...
   </executions>
 </plugin>
...
</plugins>
</build>
[top]

What are the significant reports?
    There are 2 Reports provided for your use.
  1. MainReport - A multipage report with embedded charts.
  2. MoversReport - The movers report shows what has changed over the last "x" hours.

You can configure the QALab reports as follows

<reporting>
 <plugins>
 ...         
  <plugin>
    <groupId>net.objectlab</groupId>
    <artifactId>mvn-qalab-plugin</artifactId>
    <version>2.2</version>
    <reportSets>
      <reportSet>
        <reports>
          <report>report</report>
          <report>report-movers</report>
       </reports>
     </reportSet>
   </reportSets>
 </plugin>
...
</plugins>
</reporting>  
        
[top]

Should I check in qalab.xml? And how?

Yes, you should check in qalab.xml. It is vital that you keep it over-time and checking it in you SCM (Source Control Management) is probably the easiest solution. Maven 2 can do that for you but you need to be aware of the authentication requirements of your repository.

You can configure your maven build as follows

<build>
...
 <plugins>
 ... 
  // keep the qalab.xml file updates commited to SCM after every site gen task.
  <plugin> 
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-scm-plugin</artifactId>
   <version>1.0-beta-4</version>
   <configuration>
    <includes>qalab.xml</includes>
    <message>qalab history updated</message> 
  </configuration> 
   <executions> 
    <execution>
     <phase>site</phase>
     <goals>
      <goal>checkin</goal>
    </goals>
   </execution>
  </executions> 
 </plugin> 
  ...
</plugins>
 ...
</build>
        

Further comments from Darren Hartford: As for the clean update (assuming you mean SCM update), that is already handled by Maven and or the Continuum if the maven pom.xml file has the following configured:

<scm>
  <connection>scm:svn:http://....</connection>
  <developerConnection>scm:svn:http://....</developerConnection>
</scm>

For authentication, the manual workaround is to call your maven2 task with the username and password switches

"mvn -Dusername=homer -Dpassword=simpson clean site"

The more formal workaround I think involves setting up the server-id used in the scm connection and configuring the per-local-machine /.m2/settings.xml file.

In case it is not clear, the configuration below will only check-in the qalab.xml file, nothing else. Upon further use, I would recommend modifying this to become a profile configuration based on whether running in continuous-integration mode only, instead of also happening during developer builds/tests.

[top]