Author: veithen Date: Mon Mar 11 20:35:56 2013 New Revision: 1455319 URL: http://svn.apache.org/r1455319 Log: Instrument the tests with JaCoCo to get code coverage reports. Note that this is not yet working as expected because the root/parent POM declares dependencies; they interfere with the code-coverage module.
Added: axis/axis2/java/rampart/trunk/code-coverage/ (with props) axis/axis2/java/rampart/trunk/code-coverage/pom.xml (with props) Modified: axis/axis2/java/rampart/trunk/modules/distribution/pom.xml axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml axis/axis2/java/rampart/trunk/modules/rampart-mar/pom.xml axis/axis2/java/rampart/trunk/modules/rampart-samples/pom.xml axis/axis2/java/rampart/trunk/pom.xml Propchange: axis/axis2/java/rampart/trunk/code-coverage/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Mar 11 20:35:56 2013 @@ -0,0 +1 @@ +target Added: axis/axis2/java/rampart/trunk/code-coverage/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/code-coverage/pom.xml?rev=1455319&view=auto ============================================================================== --- axis/axis2/java/rampart/trunk/code-coverage/pom.xml (added) +++ axis/axis2/java/rampart/trunk/code-coverage/pom.xml Mon Mar 11 20:35:56 2013 @@ -0,0 +1,180 @@ +<?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.rampart</groupId> + <artifactId>rampart-project</artifactId> + <version>1.7.0-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 main artifact and the source JAR as dependency. + 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>rampart-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rampart-core</artifactId> + <version>${project.version}</version> + <classifier>sources</classifier> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rampart-core</artifactId> + <version>${project.version}</version> + <classifier>jacoco</classifier> + <type>exec</type> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rampart-trust</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rampart-trust</artifactId> + <version>${project.version}</version> + <classifier>sources</classifier> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rampart-trust</artifactId> + <version>${project.version}</version> + <classifier>jacoco</classifier> + <type>exec</type> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rampart-integration</artifactId> + <version>${project.version}</version> + <classifier>jacoco</classifier> + <type>exec</type> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rampart-tests</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> Propchange: axis/axis2/java/rampart/trunk/code-coverage/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: axis/axis2/java/rampart/trunk/modules/distribution/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/distribution/pom.xml?rev=1455319&r1=1455318&r2=1455319&view=diff ============================================================================== --- axis/axis2/java/rampart/trunk/modules/distribution/pom.xml (original) +++ axis/axis2/java/rampart/trunk/modules/distribution/pom.xml Mon Mar 11 20:35:56 2013 @@ -38,7 +38,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> - <version>1.1</version> <executions> <execution> <id>build-javadoc</id> @@ -71,7 +70,6 @@ <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> - <version>1.2</version> <executions> <execution> <id>generate-timestamp</id> Modified: axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml?rev=1455319&r1=1455318&r2=1455319&view=diff ============================================================================== --- axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml (original) +++ axis/axis2/java/rampart/trunk/modules/rampart-integration/pom.xml Mon Mar 11 20:35:56 2013 @@ -100,7 +100,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> - <version>1.1</version> <executions> <execution> <id>generate-source</id> @@ -581,7 +580,7 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <!-- Add the Xerces/Xalan versions expected by OpenSAML to the boot classpath so that the build succeeds on older 1.5 JDKs --> - <argLine>${argLine} -Xbootclasspath/p:${project.build.directory}/endorsed/xml-apis.jar${path.separator}${project.build.directory}/endorsed/xercesImpl.jar${path.separator}${project.build.directory}/endorsed/resolver.jar${path.separator}${project.build.directory}/endorsed/serializer.jar${path.separator}${project.build.directory}/endorsed/xalan.jar</argLine> + <argLine>${jacoco.surefireArgLine} -Xbootclasspath/p:${project.build.directory}/endorsed/xml-apis.jar${path.separator}${project.build.directory}/endorsed/xercesImpl.jar${path.separator}${project.build.directory}/endorsed/resolver.jar${path.separator}${project.build.directory}/endorsed/serializer.jar${path.separator}${project.build.directory}/endorsed/xalan.jar</argLine> </configuration> </plugin> </plugins> Modified: axis/axis2/java/rampart/trunk/modules/rampart-mar/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-mar/pom.xml?rev=1455319&r1=1455318&r2=1455319&view=diff ============================================================================== --- axis/axis2/java/rampart/trunk/modules/rampart-mar/pom.xml (original) +++ axis/axis2/java/rampart/trunk/modules/rampart-mar/pom.xml Mon Mar 11 20:35:56 2013 @@ -70,7 +70,6 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> - <version>1.0</version> <executions> <execution> <id>aar</id> Modified: axis/axis2/java/rampart/trunk/modules/rampart-samples/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-samples/pom.xml?rev=1455319&r1=1455318&r2=1455319&view=diff ============================================================================== --- axis/axis2/java/rampart/trunk/modules/rampart-samples/pom.xml (original) +++ axis/axis2/java/rampart/trunk/modules/rampart-samples/pom.xml Mon Mar 11 20:35:56 2013 @@ -47,7 +47,6 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> - <version>1.7</version> <executions> <execution> <phase>generate-sources</phase> Modified: axis/axis2/java/rampart/trunk/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/pom.xml?rev=1455319&r1=1455318&r2=1455319&view=diff ============================================================================== --- axis/axis2/java/rampart/trunk/pom.xml (original) +++ axis/axis2/java/rampart/trunk/pom.xml Mon Mar 11 20:35:56 2013 @@ -136,6 +136,27 @@ <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.10</version> + <configuration> + <argLine>${jacoco.surefireArgLine}</argLine> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.7</version> + </plugin> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>gmaven-plugin</artifactId> + <version>1.2</version> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.6</version> + </plugin> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> </plugin> </plugins> </pluginManagement> @@ -163,6 +184,89 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>gmaven-plugin</artifactId> + <executions> + <execution> + <id>initialize</id> + <phase>initialize</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source> + <!-- Skip Jacoco if necessary --> + if (project.packaging == 'pom' || project.properties['skipTests'] == 'true') { + project.properties['skipJacoco'] = 'true' + } + </source> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>${jacoco.version}</version> + <executions> + <execution> + <id>prepare-agent-for-surefire</id> + <goals> + <goal>prepare-agent</goal> + </goals> + <configuration> + <propertyName>jacoco.surefireArgLine</propertyName> + <!-- Anonymize the session ID (by default it contains the name of the host executing the build) --> + <sessionId>mvn:${project.groupId}:${project.artifactId}:${project.version}:surefire</sessionId> + </configuration> + </execution> + </executions> + <configuration> + <skip>${skipJacoco}</skip> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-jacoco-exec</id> + <phase>test</phase> + <goals> + <goal>attach-artifact</goal> + </goals> + <configuration> + <skipAttach>${skipJacoco}</skipAttach> + <artifacts> + <artifact> + <file>${project.build.directory}/jacoco.exec</file> + <classifier>jacoco</classifier> + <type>exec</type> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <!-- We need (some of) the source JARs for the code coverage analysis. --> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <!-- Use the same ID as in org.apache:apache; otherwise, the goal + will be executed twice when the apache-release profile is + activated --> + <id>attach-sources</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + <configuration> + <attach>true</attach> + </configuration> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -380,6 +484,7 @@ <module>modules/rampart-integration</module> <!-- Compile sample codes --> <module>modules/rampart-samples</module> + <module>code-coverage</module> </modules> <properties> @@ -397,5 +502,6 @@ <dist.dir>rampart-${project.version}</dist.dir> <failIfNoTests>false</failIfNoTests> + <jacoco.version>0.6.1.201212231917</jacoco.version> </properties> </project>