Recognize aggregated sonar reports 71/78171/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 26 Nov 2018 20:40:12 +0000 (21:40 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 26 Nov 2018 20:40:12 +0000 (21:40 +0100)
This adds the necessary build support to aggregate jacoco reports,
so sonar can pick them up.

Change-Id: I345c449cb5a027ed043171659e74c74d93e5b223
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
pom.xml

diff --git a/pom.xml b/pom.xml
index 665e52e4e3624783188c00fed650aa2c053a8204..edf9ac4632406b76f37bfc60dfeea41dec73e85e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <!-- archetypes -->
     <module>opendaylight/archetypes</module>
   </modules>
+
+  <profiles>
+    <profile>
+      <id>sonar-jacoco-aggregate</id>
+      <activation>
+        <property>
+          <name>odl.jacoco.aggregateFile</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.jacoco</groupId>
+            <artifactId>jacoco-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>merge</id>
+                <goals>
+                    <goal>merge</goal>
+                </goals>
+                <phase>generate-resources</phase>
+                <configuration>
+                  <destFile>${odl.jacoco.aggregateFile}</destFile>
+                  <fileSets>
+                    <fileSet>
+                      <directory>${project.basedir}</directory>
+                      <includes>
+                        <include>**/target/code-coverage/*.exec</include>
+                      </includes>
+                    </fileSet>
+                  </fileSets>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
   <scm>
     <connection>scm:git:http://git.opendaylight.org/gerrit/controller.git</connection>
     <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>