How do different code branches do code analysis on Sonar? For example, one project has three branches of master, MySQL, and Xiangxiang, and 3 code-checking jobs are built on Jenkins, which is expected to be shown separately from the three-branch code-checking results area. But sonar will count the results of 3 branches into a single project, and not be divided into 3 project statistics.
So how to solve this problem. Often found in the sonar management system has a "update identity" function, using this feature can achieve 3 branches 3 code inspection results. Here's a picture demo.
(1) The name of the project in the pom.xml of three branches is modified to the name of each branch, such as the Xiangxiang branch modified to Hbgms_xiangxiang.
(2) Create a new code check job in Jenkins, execute a job, find the result statistic in sonar, click in
(3) Click "Configure"-> "Update Logo"
(4) Change the identity from the package name to the project name, as shown below
(5) Other branches of the code check also follow this operation, you can complete. The effect of the following figure