Coverage metric shows 0.0%

  • ALM used (AWS , Red Hat OpenShift 3.11)

  • CI system used ( OpenShift DevOps image with Jenkins CI )

  • Scanner command used when applicable:
    mvn sonar:sonar -Dsonar.host.url=https://hostname.openshiftapps.com -Dsonar.projectName=${JOB_BASE_NAME} -Dsonar.login=f323blogintokenb9402427logintoken190cf74d

  • Languages of the repository: JAVA, XML

  • Only if the SonarCloud project is public, the URL : -

  • Error observed: The same project shows 60% coverage in other environment that was installed in VM´s

  • Steps to reproduce
    deploy a SonarQube image from marketplace in OpenShift (AWS cloud)
    scan a project with unit test configurations and unit test written.

  • Potential workaround: -

Hi @arthurxl and welcome to the community !

So, i’m not sure, are you using SonarQube or SonarCloud ?

Where is located the Sonar maven task in your CI workflow ?

Thanks.

Hi Mickaël, thanks for your reply

-Are you using SonarQube or SonarCloud ?

-I’m Using SonarQube that was installed in OpenShift container on AWS, the container image of SonarQube was download from:

https://hub.docker.com/_/sonarqube

-Where is located the Sonar maven task in your CI workflow ?

-In Jenkins pipeLine

Regards.

Thanks.

I meant, where is the task located inside your pipeline ? It should be after some kind of maven task (like a build or something else) like this :

mvn clean verify sonar:sonar

or :

mvn clean install
mvn sonar:sonar

Is that something that you are currently doing already ? Make sure as well that the code coverage file is generated before invoking the sonar goal and that a valid property is set for passing the coverage file to the scanner (see here)

Thanks.