sonarpom
prathabanKavin 3 months ago
parent 94b3b2b40d
commit fc5643dee4

@ -38,25 +38,26 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
</configuration>
<version>${jacoco.maven.plugin.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-unit.exec</destFile> <!-- Use standard target path -->
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<id>jacoco-report</id>
<phase>prepare-package</phase> <!-- Changed phase to prepare-package to ensure exec is generated before reporting -->
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
<outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
<dataFile>${project.build.directory}/jacoco-unit.exec</dataFile>
<outputDirectory>${project.build.directory}/coverage-reports/site</outputDirectory> <!-- Adjusted to standard output path -->
</configuration>
</execution>
</executions>

@ -2069,26 +2069,25 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<executions>
<!-- Prepares the JaCoCo agent for code coverage -->
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco-ut.exec</destFile>
<destFile>${basedir}/target/coverage-reports/jacoco-aggregate.exec</destFile>
<append>true</append>
</configuration>
</execution>
<!-- Post-execution: generates the JaCoCo report -->
<execution>
<id>report</id>
<id>report-aggregate</id>
<phase>verify</phase> <!-- Or another phase as needed -->
<goals>
<goal>report</goal>
<goal>report-aggregate</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco-ut.exec</dataFile>
<outputDirectory>${basedir}/target/site/jacoco</outputDirectory>
<outputDirectory>${project.build.directory}/site/jacoco</outputDirectory>
<!-- No dataFile needed here -->
</configuration>
</execution>
</executions>

Loading…
Cancel
Save