Teach top-level aggregator about jacoco/sonar 59/78759/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 13 Dec 2018 15:37:30 +0000 (16:37 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 13 Dec 2018 15:37:30 +0000 (16:37 +0100)
This adds the profile to merge all jacoco reports, so that sonar
job can use the aggregated file.

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

diff --git a/pom.xml b/pom.xml
index 55927e310e19270facc5ec352b6b1fb042afbdf2..0b5c8ada94e2b015b6e30076fc47f2c6b879d16b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                 </plugins>
             </build>
         </profile>
+        <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>
 
 </project>