summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-01-21 10:48:11 -0500
committerDan Timoney <dtimoney@att.com>2020-01-21 10:48:11 -0500
commit5f1d4a79db0e7fb726cc2f311a0acbf847604c37 (patch)
tree3d4c0d383a46ab5aece15837082e561671a3ddc5
parenta7df50971777ebf03f8a78780f4e2ddc8120f9c5 (diff)
Add sonar/jacoco config
Add necessary sonar/jacoco config changes for new version of scanner compatible with sonarcloud. Change-Id: Ie2a68e6ef9e4ab411fa33d4fc94bc4a385d78d64 Issue-ID: SDNC-1020 Signed-off-by: Dan Timoney <dtimoney@att.com>
-rw-r--r--pom.xml1
-rw-r--r--pomba/pom.xml112
2 files changed, 112 insertions, 1 deletions
diff --git a/pom.xml b/pom.xml
index 628ed3c..dfe9642 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,6 @@
<description>POM to be used for apps in SDNC project</description>
<modules>
- <module>client</module>
<module>pomba</module>
</modules>
</project>
diff --git a/pomba/pom.xml b/pomba/pom.xml
index c823064..0cfde48 100644
--- a/pomba/pom.xml
+++ b/pomba/pom.xml
@@ -31,6 +31,20 @@ limitations under the License.
<version>1.8.0-SNAPSHOT</version>
<packaging>pom</packaging>
+ <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>
+ </properties>
+
<modules>
<module>network-discovery</module>
<module>network-discovery-api</module>
@@ -51,6 +65,104 @@ limitations under the License.
</execution>
</executions>
</plugin>
+ <!-- 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>
</plugins>
</build>
<profiles>