SonarQube code coverage for AEM project
Hi All,
We are using separate Sonarqube server and integrated with our application. Using that we are able to receive the code vulnerabilities properly. But Generating the Code Coverage is having issues. Currently we have integrated with Jacoco Plugin with SonarQube for Code Coverage and we have installed Sonarqube with AEM rules plugin version 1.0.
We have done below changes in POM file -
POM Changes
<properties>
<sonar.exclusions>**/*.js,**/*.xml,lib/*,packages/*,ui.galen/*,**/*.json,ui.npm/*,content/*</sonar.exclusions>
<sonar.junit.reportPaths>bundle/target/surfire-reports</sonar.junit.reportPaths>
<sonar.jacoco.reportPaths>bundle/target/jacoco.exec</sonar.jacoco.reportPaths>
</properties>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</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>bundle/target/jacoco.exec</destFile>
<excludes>
<exclude>**/*.js</exclude>
<exclude>**/*.xml</exclude>
<exclude>lib/*</exclude>
<exclude>packages/*</exclude>
<exclude>ui.galen/*</exclude>
<exclude>**/*.json</exclude>
<exclude>ui.npm/*</exclude>
<exclude>content/*</exclude>
</excludes>
<!-- 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>bundle/target/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>bundle/target</outputDirectory>
</configuration>
</execution>
<execution>
<id>generate-code-coverage-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
SONAR Command Used
mvn clean package sonar:sonar
With all these changes we are getting code coverage 0.0. So, please help me to resolve this issue.
Note: We are able to see the Code Coverage in IDE – Eclipse/IntelliJ. But not able to get the coverage report in sonarqube site.
Thanks,
Debal