Sonarqube generic issues import format android not uploading to sonarqube server

SonarQube version:- 8.5 developer edition

We are trying to display warnings in sonarqube server using Generic Issues Import Format

Below is our json format that we have formed:-

{
  "issues": [
    {
      "engineId": "Compiler Warning",
      "ruleId": "Warning",
      "severity": "MAJOR",
      "type": "CODE_SMELL",
      "primaryLocation": {
        "message": " Unnecessary safe call on a non-null receiver of type CMAnimatedImage?",
        "filePath": "path to the file",
        "textRange": {
          "startLine": "20",
          "endLine": "20"
        }
      }
    }
  ]
}

We are settings the below configurations in the sonarqube configurations file:-
property “sonar.issuesReport.json.enable”, “true”
property “sonar.externalIssuesReportPaths”, file("${rootProject.projectDir}/SonarQubeIssueData.json")

However, even after following the above steps and the steps mentioned in https://docs.sonarqube.org/latest/analysis/generic-issue/, the issues mentioned in the json are not reflecting in our sonarqube server.

Any help in this regard would be appreciated. Thank you.

Hi @Sai_Krishna_Abbagoun,

I’m not sure whether you’ve deliberately obfuscated it, but your filePath looks strange. Is it really "path to the file" or do you have an actual filename (relative to the root of the project) here?

Regards,

Cameron.

Hi @Cameron,

Yes, I purposefully obfuscated the filepath here in the forum. I have actual filepath in my json. Thank you.

Hi @Sai_Krishna_Abbagoun,

I’ve run a quick test with your JSON and (assuming the path name is valid) it works fine, so the specification of the issue is not the problem. Looking at your configuration

it looks like you’re using Gradle, is that correct? I just tried this with Gradle and it works fine. If the configuration is correct and you run your Gradle analysis with --debug you should see something like the following in your log file:

2020-12-03T12:08:15.491+0100 [INFO] [org.sonarqube.gradle.SonarQubeTask] Sensor Import external issues report
2020-12-03T12:08:15.491+0100 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] Importing issues from '/<path_to_json_file>/SonarQubeIssueData.json'
2020-12-03T12:08:15.497+0100 [INFO] [org.sonarqube.gradle.SonarQubeTask] Imported 1 issue in 1 file

Can you check and see if your logs have this entry?

Regards,

Cameron.