Importing External Issues

Using SonarQube 7.3 and the latest download of sonar-scanner, how does one import external issues? As a sanity check I’m attempting to import the example generic issue json for Generic Issue Data

My sonar-project.properties file contains this:

sonar.host.url=http://localhost:9000
sonar.projectKey=abc123321
sonar.projectName=PLEASE_WORK
sonar.projectVersion=1.0
sonar.sources=SonarQubeIssueData.json
sonar.externalIssuesReportPaths=SonarQubeIssueData.json
sonar.issuesReport.json.enable=true
sonar.log.level=TRACE
sonar.verbose=true
sonar.showProfiling=true

The SonarQubeIssueData.json file contains the json from Generic Issue Data

I then execute from the same directory containing the above properties file:
sonar-scanner -X

I see that something is happening in the SonarQube log. And the sonar-scanner log reports a success:
12:57:20.512 INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=abc123321

However, none of the external issues show in the SonarQube web console.

What am I missing?

Hi Jason,

Did you adapt the filepaths so that they correspond to actual files that are being scanned by SonarQube ? SonarQube will import the external issue(s) only if they relate to source file(s) that’s actually been analyzed (and which can then be browsed in SQ).

Woops! That solved it. Thank you!

1 Like

Hi,
Is it possible to use the properties “sonar.externalIssuesReportPaths” with SonarQube 6.7.3
Best regards,
Frédéric Depale

Nope, this capability was introduced and announced in SonarQube 7.2.

Thanks a lot !

Hi @NicoB,

After upgrading SonarQube from 8.2 to 8.5, generic issue format is not working me. Below is my SonarQubeIssueData.json file.
{
“issues”: [
{
“engineId”: “test”,
“ruleId”: “rule1”,
“severity”: “BLOCKER”,
“type”: “CODE_SMELL”,
“primaryLocation”: {
“message”: “fully-fleshed issue”,
“filePath”: “my file path”,
“textRange”: {
“startLine”: 30,
“endLine”: 30
}
}
}
]
}

Can you please help me with it?

Many Thanks!