running maven sonar:sonar on multiple branches of the same source project

maven, sonarqube

Solution

I found your question while searching for a similar topic, and I noticed you had not received an answer. If you pass the -Dsonar.branch, each branch will be treated as a different project. As documented here:

http://sonarqube.15.x6.nabble.com/Sonar-Analysis-for-Feature-Branches-td5004642.html#a5004647

Hope this helps.

Problem

We currently have multiple feature releases in perforce. Each of these branches has POM files that contain a version tag and name tag that is tied to that branch. When we run sonar:sonar each branch scan overwrites another branch scan and you only see one at a time in the sonar gui. Can a sonar project be tied to maven GroupId>ArtifactId>Version or even instead of just being Tied to the GroupId. FYI, GroupId and ArtifactId do not change when we branch the POM.

Original source