Skip to content
Browse files

Added automatic code coverage reporting based on Jacoco.

  • Loading branch information...
1 parent e0a1ba6 commit a1168680fd47cca7f4c79b31c1a63c6bdef24787 @veithen veithen committed Dec 30, 2012
Showing with 344 additions and 1 deletion.
  1. +258 −0 code-coverage/pom.xml
  2. +21 −0 modules/axiom-dom/pom.xml
  3. +21 −0 modules/axiom-impl/pom.xml
  4. +43 −1 pom.xml
  5. +1 −0 src/site/site.xml
View
258 code-coverage/pom.xml
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom</artifactId>
+ <version>1.2.15-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>code-coverage</artifactId>
+ <name>Code Coverage Report</name>
+ <packaging>pom</packaging>
+ <dependencies>
+ <!--
+ For each project that should appear in the coverage report, add the following dependencies:
+ * The main artifact if it is not shaded, or the original (unshaded) artifact.
+ * The sources JAR.
+
+ For each project that contributes code coverage, add a dependency to the jacoco.exec file
+ (i.e. classifier=jacoco and type=exec).
+ -->
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-common-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-common-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-common-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>original</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-dom</artifactId>
+ <version>${project.version}</version>
+ <classifier>original</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-dom</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-dom</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-jaxb</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-jaxb</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-tests</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-integration</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-osgi-tests</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-samples</artifactId>
+ <version>${project.version}</version>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-jacoco-exec</id>
+ <phase>site</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/jacoco/exec</outputDirectory>
+ <includeClassifiers>jacoco</includeClassifiers>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-sources</id>
+ <phase>site</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/jacoco/sources</outputDirectory>
+ <includeClassifiers>sources</includeClassifiers>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-classes</id>
+ <phase>site</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/jacoco/classes</outputDirectory>
+ <includeTypes>jar</includeTypes>
+ <excludeClassifiers>sources</excludeClassifiers>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jacoco-report</id>
+ <phase>site</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <taskdef name="report" classname="org.jacoco.ant.ReportTask"/>
+ <report>
+ <executiondata>
+ <fileset dir="${project.build.directory}/jacoco/exec"/>
+ </executiondata>
+ <structure name="Coverage Report">
+ <classfiles>
+ <fileset dir="${project.build.directory}/jacoco/classes"/>
+ </classfiles>
+ <sourcefiles>
+ <fileset dir="${project.build.directory}/jacoco/sources"/>
+ </sourcefiles>
+ </structure>
+ <html destdir="${project.reporting.outputDirectory}" />
+ </report>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jacoco</groupId>
+ <artifactId>org.jacoco.ant</artifactId>
+ <version>${jacoco.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
View
21 modules/axiom-dom/pom.xml
@@ -183,6 +183,27 @@
</dependency>
</dependencies>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-original-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/original-${project.build.finalName}.jar</file>
+ <classifier>original</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<!-- Attach a JAR with the test classes so that we can reuse them in other modules
(see http://maven.apache.org/guides/mini/guide-attached-tests.html). -->
<plugin>
View
21 modules/axiom-impl/pom.xml
@@ -166,6 +166,27 @@
</dependency>
</dependencies>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-original-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/original-${project.build.finalName}.jar</file>
+ <classifier>original</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<!-- Attach a JAR with the test classes so that we can reuse them in other modules
(see http://maven.apache.org/guides/mini/guide-attached-tests.html). -->
<plugin>
View
44 pom.xml
@@ -399,6 +399,7 @@
<stax.impl.version>1.2.0</stax.impl.version>
-->
<shade.plugin.version>1.6</shade.plugin.version>
+ <jacoco.version>0.6.1.201212231917</jacoco.version>
</properties>
<build>
<extensions>
@@ -450,7 +451,7 @@
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
- <version>2.1</version>
+ <version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
@@ -553,6 +554,46 @@
<attach>true</attach>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!-- Anonymize the session ID (by default it contains the name of the host executing the build) -->
+ <sessionId>mvn:${project.groupId}:${project.artifactId}:${project.version}</sessionId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <!-- Note that the execution will not fail if the file to be attached is not present.
+ Therefore it is safe to execute this for all projects. -->
+ <id>attach-jacoco-exec</id>
+ <phase>test</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/jacoco.exec</file>
+ <classifier>jacoco</classifier>
+ <type>exec</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<profiles>
@@ -649,5 +690,6 @@
<module>userguide</module>
<module>apidocs</module>
<module>distribution</module>
+ <module>code-coverage</module>
</modules>
</project>
View
1 src/site/site.xml
@@ -52,6 +52,7 @@
<item name="Javadocs" href="/apidocs/index.html"/>
<item name="FAQ" href="faq.html"/>
<item name="View Source" href="http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/?root=Apache-SVN"/>
+ <item name="Code Coverage" href="code-coverage/index.html"/>
</menu>
<menu name="Apache">
<item name="License" href="http://www.apache.org/licenses/"/>

0 comments on commit a116868

Please sign in to comment.
Something went wrong with that request. Please try again.