Scan master (main) branch and pull request?

SonarQube 8.5 EDIT: 8.2 Developer Edition

Is it possible to scan both main (target, master) branch and source branch (for PR analysis)?

During my build PR analysis is just fine, the scan is successful, but in Sonarqube master branch shows as not scanned:
"master" branch has not been analyzed yet and you have multiple branches already. It looks like it is not your Main Branch, check your configuration

When I use both: and sonar.pullrequest.branch
I get the error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project mqe-hob-tests: A pull request analysis cannot have the branch analysis parameter ''

I would like to avoid creating a separate job just for scanning master branch. I use scanner for maven in Jenkins pipeline job.



Welcome to the community!

I guess you’re actually using SonarQube 8.4, rather than writing from the future? :joy:

In fact, with Jenkins, I don’t believe you should have to specify branch/PR parameters at all. We’ve done some work there to read those values from the environment and apply them when/if necessary. The docs may help.