aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-04-19 13:37:09 +0100
committeradheli.tavares <adheli.tavares@est.tech>2024-04-19 13:43:07 +0100
commit4c98efedfb6c1c253cbfe54c9469436957c59cfc (patch)
treeede82fb05c8bf4122a415613ff6be34e5311d51b
parent14f51a7e33c1e29c70279fd0100c0253692c7025 (diff)
Fix for Jacoco configuration to generate reports for code coverage
Issue-ID: POLICY-4962 Change-Id: I3cb5a6fe2730bb577b310d584ec7e029551f3d3d Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
-rw-r--r--integration/pom.xml67
-rw-r--r--pom.xml7
2 files changed, 41 insertions, 33 deletions
diff --git a/integration/pom.xml b/integration/pom.xml
index b50cc62c..20ba7faf 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -40,11 +40,11 @@
<!-- Note Well: For RELEASE/SNAPSHOT always set to the project version -->
<version.parent.resources>4.1.2-SNAPSHOT</version.parent.resources>
<version.parent.checkstyle>4.1.2-SNAPSHOT</version.parent.checkstyle>
- <jacoco.dataFile>${project.basedir}/../target/code-coverage/jacoco-ut.exec</jacoco.dataFile>
- <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
- <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
+ <jacoco.destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</jacoco.destFile>
<!-- Default Sonar configuration -->
- <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
+ <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
+ <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml
+ </sonar.coverage.jacoco.xmlReportPaths>
<!-- Note: This list should match jacoco-maven-plugin's exclusion list below -->
<sonar.exclusions>org/drools/**/*,**/gen/**,**/generated-sources/**</sonar.exclusions>
<repo.npm>https://nexus3.onap.org/repository/npm.public/npm/-/</repo.npm>
@@ -1318,6 +1318,16 @@
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>3.2.5</version>
+ </plugin>
+ <plugin>
+ <groupId>org.sonarsource.scanner.maven</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <version>${version.sonar}</version>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
@@ -1346,6 +1356,7 @@
<exclude>**/gen/**</exclude>
<exclude>**/generated-sources/**</exclude>
</excludes>
+ <output>file</output>
</configuration>
<executions>
<execution>
@@ -1354,8 +1365,9 @@
<goal>prepare-agent</goal>
</goals>
<configuration>
- <destFile>${jacoco.dataFile}</destFile>
+ <destFile>${jacoco.destFile}</destFile>
<append>true</append>
+ <propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
@@ -1365,35 +1377,19 @@
<goal>report</goal>
</goals>
<configuration>
- <dataFile>${jacoco.dataFile}</dataFile>
- </configuration>
- </execution>
- <execution>
- <id>pre-integration-test</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- <configuration>
- <skip>true</skip>
- </configuration>
- </execution>
- <execution>
- <id>post-integration-test</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>report</goal>
- </goals>
- <configuration>
- <skip>true</skip>
+ <dataFile>${jacoco.destFile}</dataFile>
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
</configuration>
</execution>
<execution>
<id>report-aggregate</id>
- <phase>prepare-package</phase>
+ <phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
+ <configuration>
+ <includeCurrentProject>true</includeCurrentProject>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -1453,6 +1449,23 @@
</dependency>
</dependencies>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the VM argument line used when integration tests are run. -->
+ <argLine>${failsafeArgLine}</argLine>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/pom.xml b/pom.xml
index 18c74a37..ce8f8de0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
<artifactId>formatter-maven-plugin</artifactId>
<version>2.11.0</version>
<configuration>
- <configFile>${project.parent.basedir}/onap-java-formatter.xml</configFile>
+ <configFile>${project.basedir}/onap-java-formatter.xml</configFile>
</configuration>
<!-- https://code.revelc.net/formatter-maven-plugin/
use mvn formatter:format to rewrite source files
@@ -88,11 +88,6 @@
use mvn spotless:apply to rewrite source files
use mvn spotless:check to validate source files -->
</plugin>
- <plugin>
- <groupId>org.sonarsource.scanner.maven</groupId>
- <artifactId>sonar-maven-plugin</artifactId>
- <version>${sonar.scanner.version}</version>
- </plugin>
</plugins>
</pluginManagement>
</build>