How can i change short lived branch to long lived branch

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) - 7.5

  • what are you trying to achieve
    I’m trying to build the solution for different branches (like master and develop).But it was working only for the Master branch and not showing any report for the develop branch.

  • what have you tried so far to achieve this
    I created the build definition by adding Prepare analysis on SonarQube before the build solution task and then after the build solution task , added run code analysis task and provided all the details.

Initially I was tried with develop branch only, but I get the following error

ERROR: error during sonarqube scanner execution
ERROR: Project was never analyzed. A regular analysis is reuired before a branch analysis

so when I changed the branch to Master, then the build succeeded and sent the report to the sonar url
now when I changed back my branch from master to develop, now the build succeeded but in sonar url it did not provide any report for the develop branch.

Can you help us how can we resolve this issue because we are having same issue with other application also.

this is a known problem when using != master for an initial scan.
See for a similar posting.
Before using there has to be a project with a main branch (default = master), to be able to scan the changeset between the main branch and the feature branch.
The simple solution proposed by @Fabrice_Bellingard says the project has to be created first.
I’ve created a feature request via Sonarsource Enterprise support to catch that “error” and create the project automatically instead, before doing the scan for the feature branch.
Our workaround in Jenkins pipelines so far is to use the property only if branchname != master.