Fix code coverage for sonar
[cps.git] / cps-parent / pom.xml
old mode 100644 (file)
new mode 100755 (executable)
index d3470df..125c843
@@ -20,7 +20,7 @@
         <base.image>openjdk:11-jre-slim</base.image>
         <java.version>11</java.version>
         <jib-maven-plugin.version>2.6.0</jib-maven-plugin.version>
-        <minimum-coverage>0.44</minimum-coverage>
+        <minimum-coverage>0.76</minimum-coverage>
         <nexusproxy>https://nexus.onap.org</nexusproxy>
         <oparent.version>3.1.0</oparent.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
         <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
         <tag.version>${project.version}</tag.version>
+
+        <jacoco.reportDirectory.aggregate>${project.reporting.outputDirectory}/jacoco-aggregate</jacoco.reportDirectory.aggregate>
+        <sonar.coverage.jacoco.xmlReportPaths>
+            ../cps-ri/target/site/jacoco-ut/jacoco.xml,
+            ../cps-ri/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-service/target/site/jacoco-ut/jacoco.xml,
+            ../cps-service/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-rest/target/site/jacoco-ut/jacoco.xml,
+            ../cps-rest/target/site/jacoco-aggregate/jacoco.xml,
+        </sonar.coverage.jacoco.xmlReportPaths>
     </properties>
 
     <distributionManagement>
                         <!-- Reports all bugs (other values are medium and max) -->
                         <threshold>Low</threshold>
                         <!-- Build doesn't fail if problems are found -->
-                        <failOnError>false</failOnError>
+                        <failOnError>true</failOnError>
                         <!-- References the excluded rules -->
                         <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
                         <!-- Produces XML report -->
                             </rules>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>report</id>
+                        <goals>
+                            <goal>report-aggregate</goal>
+                        </goals>
+                        <phase>verify</phase>
+                        <configuration>
+                            <dataFileIncludes>
+                                <fileInclude>**/code-coverage/jacoco-ut.exec</fileInclude>
+                            </dataFileIncludes>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
                 <groupId>com.github.spotbugs</groupId>
                 <artifactId>spotbugs-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>org.sonarsource.scanner.maven</groupId>
+                <artifactId>sonar-maven-plugin</artifactId>
+            </plugin>
         </plugins>
     </build>
 </project>
\ No newline at end of file