Add aggragate coverage support 87/98687/2
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Wed, 20 Nov 2019 20:34:56 +0000 (12:34 -0800)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Wed, 20 Nov 2019 20:51:26 +0000 (12:51 -0800)
This adds the build-system-side of aggragating jacoco reports
for sonar.

Issue-ID: CIMAN-343
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Change-Id: If1b0b7dfcf119141c71eeaa783c7a7f62385efcf

pom.xml

diff --git a/pom.xml b/pom.xml
index 894e4c0..01b9628 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       <url>${onap.nexus.url}/content/repositories/snapshots</url>
     </snapshotRepository>
   </distributionManagement>
+  <profiles>
+    <profile>
+      <id>sonar-jacoco-aggregate</id>
+      <activation>
+        <property>
+          <name>onap.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>${onap.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>
   <build>
     <pluginManagement>
       <plugins>
             </execution>
           </executions>
         </plugin>
-        <!-- https://mvnrepository.com/artifact/org.sonarsource.scanner.maven/sonar-maven-plugin -->
-        <plugin>
-          <groupId>org.sonarsource.scanner.maven</groupId>
-          <artifactId>sonar-maven-plugin</artifactId>
-          <version>3.2</version>
-        </plugin>
       </plugins>
     </pluginManagement>
     <plugins>