Multiple Long-lived branches not working

Developer Edition
Offline Distribution

Sonar Scanner Windows:

Git Plugin:
Version: 1.8 (build 1574)

GitHub Authentication for SonarQube:
Version: 1.5 (build 870)

Our organization uses gitflow workflow for our projects and we consider develop and master to be long-lived branches. Develop is promoted to master periodically depending on when we are releasing our product in order for stabilizing work to be completed in master ahead of release. Ideally we could have both develop and master scanned in SonarQube and analyzed as long-lived branches. Unfortunately when I submitted develop initially I forgot to change the regex and it showed up as a short-lived branch. I tried deleting the branch, changing the regex in the “Detection of long lived branches” section to “(develop|master)”, and then resubmitting the scan but it still showed up as a short-lived branch. I then tried changing the branch name to “alpha” as a test and changed the regex to “(develop|master|alpha)” to see if it was because of my accidental submission of develop initially, but alpha still showed up as a short-lived branch.

I saw this post (Having multiple long-lived branches on GitHub) where someone said “I think issue is that SonarQube project was created after Develop branch existed, and thus updating the RegEx does not have an impact on its status as long-lived, unfortunately.” Is it because my project in SonarQube was created before the regex was changed? If so do I need to delete my project in SonarQube and recreate it? Or am I missing something?


You shouldn’t need to delete your project. I think the problem is with your branch name pattern somehow. I just copy/paged your pattern:


Then analyzed with “develop”

And got a Long-Lived Branch, as expected:

Now… if you deleted your “develop” branch and immediately reanalyzed without first analyzing master, it’s possible(?) that your short-lived branch was reanimated since real deletion happens at the end of analysis, but that wouldn’t explain your Alpha branch. So I come back to your pattern.

Sorry I can’t be more helpful than that…



Thanks for the reply I ironically just figured out a workaround for this, albeit not a conventional one. I went into the SQL server database that SonarQube uses and looked at the tables. What I found were there were two entries in the “Properties” table for the regex. One of those entries was referencing my project (the default regex) and the other wasn’t referencing anything but had the correct regex (not the default one). What I decided to try was update the regex for the one that was referencing my project and restart the SonarQube windows service. When I did that the next analysis for develop showed up as a Long-Lived branch. It is possible there might have been another way to accomplish this, but I am happy that it worked.


Sounds like you had a project-level setting overriding the global one.

I’m not allowed to condone direct modification of the DB, but I’m glad you got it working.