summaryrefslogtreecommitdiffstats
path: root/standalone/pom.xml
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-01-20 10:57:59 -0500
committerDan Timoney <dtimoney@att.com>2020-01-20 10:58:03 -0500
commit017e0b342dde7f00e105dffb80f3a5649c3673d6 (patch)
treebd7b241360778dc181e7300fb4e73169df6570a8 /standalone/pom.xml
parent621888e708275d68f45946afbbdc1c7e4db64dde (diff)
Fix sonar test coverage
Updated standalone parent pom to fix sonar and jacoco configuration to be compatible with SonarCloud. Change-Id: Ieb1643be13f2de990304b895f2bf5ba48d5790a9 Issue-ID: CCSDK-2029 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'standalone/pom.xml')
-rwxr-xr-xstandalone/pom.xml112
1 files changed, 108 insertions, 4 deletions
diff --git a/standalone/pom.xml b/standalone/pom.xml
index a211cb9f..ce4ddfe1 100755
--- a/standalone/pom.xml
+++ b/standalone/pom.xml
@@ -27,7 +27,17 @@
</issueManagement>
<properties>
+ <!-- Sonar properties -->
+ <sonar.scanner.version>3.7.0.1746</sonar.scanner.version>
+ <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
+ <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
+ <!-- Default Sonar configuration -->
+ <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml,${project.reporting.outputDirectory}/jacoco-it/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
+ <!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->
+ <sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>
+ <!-- Jacoco properties -->
+ <jacoco.version>0.8.5</jacoco.version>
<!-- ONAP repositories -->
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
<onap.nexus.host>nexus.onap.org</onap.nexus.host>
@@ -45,10 +55,6 @@
<bundle.plugin.version>2.5.0</bundle.plugin.version>
<checkstyle.skip>true</checkstyle.skip>
- <sonar.language>java</sonar.language>
- <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
- <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
- <sonar.projectVersion>${project.version}</sonar.projectVersion>
<mariadb.connector.version>2.1.1</mariadb.connector.version>
<fasterxml.jackson.version>2.9.8</fasterxml.jackson.version>
@@ -209,6 +215,104 @@
</plugins>
</pluginManagement>
<plugins>
+ <!-- Jacoco / Sonar -->
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco.version}</version>
+ <executions>
+ <execution>
+ <id>pre-unit-test</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
+ <!-- Sets the name of the property containing the settings for JaCoCo
+ runtime agent. -->
+ <propertyName>surefireArgLine</propertyName>
+ </configuration>
+ </execution>
+ <!-- Ensures that the code coverage report for unit tests is created
+ after unit tests have been run. -->
+ <execution>
+ <id>post-unit-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>pre-integration-test</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
+ <!-- Sets the name of the property containing the settings for JaCoCo
+ runtime agent. -->
+ <propertyName>failsafeArgLine</propertyName>
+ </configuration>
+ </execution>
+ <!-- Ensures that the code coverage report for integration tests after
+ integration tests have been run. -->
+ <execution>
+ <id>post-integration-test</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>default-prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-report</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-check</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <rule>
+ <element>PACKAGE</element>
+ <limits>
+ <limit>
+ <counter>COMPLEXITY</counter>
+ <value>COVEREDRATIO</value>
+ <minimum>0.0</minimum>
+ </limit>
+ </limits>
+ </rule>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>