Hi Team,
We are trying to send Munit code coverage report to sonar Dashboard by configuring pom.xml file as below.
====================pom.xml=====================================
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.projectkey>project name</sonar.projectkey>
<property name="sonar.sources" value="src"/>
<property name="sonar.binaries" value="target"/>
<property name="sonar.sourceEncoding" value="UTF-8"/>
<sonar.host.url>http://sonar.leaguedata.link/</sonar.host.url>
<!-- Standard dependency versions -->
<app.runtime>4.4.0-20230123</app.runtime>
<mule.maven.plugin.version>3.8.2</mule.maven.plugin.version>
<sockets.connector.version>1.2.1</sockets.connector.version>
<munit.version>2.3.9</munit.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
</plugin>
<plugin>
<groupId>com.mulesoft.munit.tools</groupId>
<artifactId>munit-maven-plugin</artifactId>
<version>2.3.9</version>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
<goal>coverage-report</goal>
</goals>
</execution>
</executions>
<configuration>
<coverage>
<runCoverage>true</runCoverage>
<!-- <failBuild>false</failBuild>
<requiredApplicationCoverage>70</requiredApplicationCoverage> -->
<formats>
<format>console</format>
<format>html</format>
<format>json</format>
<format>sonar</format>
</formats>
</coverage>
<runtimeProduct>MULE_EE</runtimeProduct>
<runtimeVersion>4.4.0-20230123</runtimeVersion>
</configuration>
</plugin
=======================end if pom.xml file ===========================
`command executed in AWS Code build
mvn clean sonar:sonar -Dsonar.login=“$LOGIN” -Dsonar.host.url=“$HOST” -Dsonar.sources=src/
$LOGIN - sonar login url fetched from variables
$HOST - host details fetched from variables
Attaching sonar complete logs below. Build says successful but the code coverage is not updated in the sonar dashboard
=====================sonar logs======================
[Container] 2023/05/23 20:24:44 Running command mvn clean sonar:sonar -Dsonar.login="$LOGIN" -Dsonar.host.url="$HOST" -Dsonar.sources=src/
[INFO] Scanning for projects...
Downloading from : https://repository.mulesoft.org/releases/org/codehaus/mojo/maven-metadata.xml
Downloading from : https://repository.mulesoft.org/releases/org/apache/maven/plugins/maven-metadata.xml
Progress (*): 76* B
Downloaded from : https://repository.mulesoft.org/releases/org/apache/maven/plugins/maven-metadata.xml (76* B at 2.* kB/s)
Downloading from : https://repository.mulesoft.org/releases/org/codehaus/mojo/sonar-maven-plugin/maven-metadata.xml
[INFO]
[INFO] ---------< 7464d9e7-*be2-4e59-a533-500e7372ed06:m-forge-eapi >----------
[INFO] Building m-forge-eapi *.0.0
[INFO] --------------------------[ mule-application ]--------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean-*) @ m-forge-eapi ---
[INFO] Deleting /***/output/src026/src/s3/00/target
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ m-forge-eapi ---
[INFO]
[INFO] --- mule-maven-plugin:3.8.2:clean (default-clean) @ m-forge-eapi ---
[INFO]
[INFO] ---------< 7464d9e7-*be2-4e59-a533-500e7372ed06:m-forge-eapi >----------
[INFO] Building m-forge-eapi *.0.0
[INFO] --------------------------[ mule-application ]--------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.9.*.2*84:sonar (default-cli) @ m-forge-eapi ---
[INFO] User cache: /root/.sonar/cache
[INFO] SonarQube version: 8.9.9
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Load global settings
[INFO] Load global settings (done) | time=90ms
[INFO] Server id: BF4*A*F2-AYI5PWFRZEM4LrpDfv2o
[INFO] User cache: /root/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=44ms
[INFO] Load/download plugins (done) | time=*072ms
[INFO] Process project properties
[INFO] Process project properties (done) | time=*0ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=*ms
[INFO] Project key: 7464d9e7-*be2-4e59-a533-500e7372ed06:m-forge-eapi
[INFO] Base dir: /***/output/src026/src/s3/00
[INFO] Working dir: /***/output/src026/src/s3/00/target/sonar
[INFO] Load project settings for component key: '7464d9e7-*be2-4e59-a533-500e7372ed06:m-forge-eapi'
[INFO] Load project settings for component key: '7464d9e7-*be2-4e59-a533-500e7372ed06:m-forge-eapi' (done) | time=*4ms
[INFO] Auto-configuring with CI 'AwsCodeBuild'
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=62ms
[INFO] Auto-configuring with CI 'AwsCodeBuild'
[INFO] Load active rules
[INFO] Load active rules (done) | time=*940ms
[WARNING] SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] *2*4 files indexed
[INFO] Quality profile for mule: MuleSoft Rules for Mule 4.x
[INFO] ------------- Run sensors on module m-forge-eapi
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=*9ms
[INFO] Sensor MuleSoft JSON Report Importer [mulesoft]
[INFO] Sensor MuleSoft JSON Report Importer [mulesoft] (done) | time=6ms
[INFO] Sensor CSS Rules [cssfamily]
[INFO] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[INFO] Sensor CSS Rules [cssfamily] (done) | time=4ms
[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] No report imported, no coverage information will be imported by JaCoCo XML Report Importer
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=7ms
[INFO] Sensor C# Project Type Information [csharp]
[INFO] Sensor C# Project Type Information [csharp] (done) | time=3ms
[INFO] Sensor C# Properties [csharp]
[INFO] Sensor C# Properties [csharp] (done) | time=*ms
[INFO] Sensor JavaXmlSensor [java]
[INFO] **6 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=24ms
[INFO] **6/**6 source files have been analyzed
[INFO] Sensor JavaXmlSensor [java] (done) | time=*024ms
[INFO] Sensor HTML [web]
[INFO] Sensor HTML [web] (done) | time=8ms
[INFO] Sensor com.mulesoft.services.tools.sonarqube.sensor.MuleSensor [mulevalidationsonarqubepluginmule]
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:configuration.7
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:flows.2
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:flows.*
[INFO] Validation Result: false : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:configuration.3 internalKey=
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:flows.3
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:configuration.*0
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:configuration.9
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:configuration.8
[INFO] Validation Result: true : File: forge-eapi-post-password-reset.xml :Rule:mule4-repository:configuration.*5
[INFO] Validation Result: true : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.*3
[INFO] Validation Result: true : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.*2
[INFO] Validation Result: true : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.**
[INFO] Validation Result: false : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:application.* internalKey=
[INFO] Validation Result: false : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:application.2 internalKey=
[INFO] Validation Result: true : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.5
[INFO] Validation Result: false : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.4 internalKey=
[INFO] Validation Result: true : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.6
[INFO] Validation Result: false : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.* internalKey=
[INFO] Validation Result: true : File: forge-eapi-created-recurring-payment-test-suite.xml :Rule:mule4-repository:configuration.2
[INFO] Sensor com.mulesoft.services.tools.sonarqube.sensor.MuleSensor [mulevalidationsonarqubepluginmule] (done) | time=244*ms
[INFO] Sensor Compute size of configuration file [mulevalidationsonarqubepluginmule]
[INFO] Sensor Compute size of configuration file [mulevalidationsonarqubepluginmule] (done) | time=*6*ms
[INFO] Sensor Compute the coverage of the applications [mulevalidationsonarqubepluginmule]
[INFO] Sensor Compute the coverage of the applications [mulevalidationsonarqubepluginmule] (done) | time=*ms
[INFO] Sensor Compute number of unit test cases [mulevalidationsonarqubepluginmule]
[INFO] Sensor Compute number of unit test cases [mulevalidationsonarqubepluginmule] (done) | time=86ms
[INFO] Sensor VB.NET Project Type Information [vbnet]
[INFO] Sensor VB.NET Project Type Information [vbnet] (done) | time=*ms
[INFO] Sensor VB.NET Properties [vbnet]
[INFO] Sensor VB.NET Properties [vbnet] (done) | time=2ms
[INFO] ------------- Run sensors on project
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=7ms
[INFO] SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
[INFO] CPD Executor Calculating CPD for 0 files
[INFO] CPD Executor CPD calculation finished (done) | time=0ms
[INFO] Analysis report generated in *2*ms, dir size=* MB
[INFO] Analysis report compressed in **4ms, zip size=325 KB
[INFO] Analysis report uploaded in 64ms
[INFO] ANALYSIS SUCCESSFUL, you can browse ***dashboard?id=7464d9e7-*be2-4e59-a533-500e7372ed06%3Am-forge-eapi
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at ***api/ce/task?id=AYhKSUzzr5Pg6bgalAz6
[INFO] Analysis total time: 7.849 s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: *2.75* s
[INFO] Finished at: 2023-05-23T20:24:57Z
[INFO] ------------------------------------------------------------------------
[Container] 2023/05/23 20:24:57 Uploading S3 cache...
[Container] 2023/05/23 20:25:*2 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2023/05/23 20:25:*2 Phase context status code: Message:
[Container] 2023/05/23 20:25:*2 Expanding base directory path: .
[Container] 2023/05/23 20:25:*2 Assembling file list
[Container] 2023/05/23 20:25:*2 Expanding .
[Container] 2023/05/23 20:25:*2 Expanding file paths for base directory .
[Container] 2023/05/23 20:25:*2 Assembling file list
[Container] 2023/05/23 20:25:*2 Expanding target/*.jar
[Container] 2023/05/23 20:25:*2 Phase complete: UPLOAD_ARTIFACTS State: FAILED
[Container] 2023/05/23 20:25:*2 Phase context status code: CLIENT_ERROR Message: no matching artifact paths found