Fix sonar test coverage reporting 45/21145/1
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Tue, 26 May 2015 15:19:20 +0000 (17:19 +0200)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Tue, 26 May 2015 15:20:17 +0000 (17:20 +0200)
 - added sonar-jacoco-listeners dependency - picks up jacoco report and
   transforms it into sonar report
 - modified jacoco-maven-plugin - so that sonar is able to pick up jacoco report

Change-Id: Iebd90d8afe96f9255ec11d427de970791316ff42
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
commons/parent/pom.xml

index 57a4e476dd9340d8e856dbd0cdbfe964f1357221..223e4013d9ab786ddaca79f9aa2e0739eecee681 100644 (file)
     </dependencies>
   </dependencyManagement>
 
+    <dependencies>
+        <!-- Sonar -->
+        <dependency>
+            <groupId>org.codehaus.sonar-plugins.java</groupId>
+            <artifactId>sonar-jacoco-listeners</artifactId>
+            <version>${sonar-jacoco-listeners.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
   <build>
     <plugins>
       <plugin>
         <artifactId>jacoco-maven-plugin</artifactId>
         <executions>
           <execution>
-            <id>pre-unit-test</id>
+            <id>prepare-ut-agent</id>
+            <phase>process-test-classes</phase>
             <goals>
               <goal>prepare-agent</goal>
             </goals>
+            <configuration>
+              <destFile>${sonar.jacoco.reportPath}</destFile>
+            </configuration>
           </execution>
           <execution>
-            <id>post-unit-test</id>
-            <phase>test</phase>
+            <id>prepare-it-agent</id>
+            <phase>pre-integration-test</phase>
             <goals>
-              <goal>report</goal>
+              <goal>prepare-agent</goal>
             </goals>
             <configuration>
-              <dataFile>${sonar.jacoco.reportPath}</dataFile>
-              <includes>
-                <include>org/opendaylight/groupbasedpolicy/**/*.class</include>
-              </includes>
+              <destFile>${sonar.jacoco.itReportPath}</destFile>
             </configuration>
           </execution>
         </executions>