The following is the screenshot attached which shows the Sonar analysis of the
repository project whenever pull request is made from the local repository
In the middle right corner, you can see the Sonar Analysis report, but here the problem is when we redirect to the link of the project as highlighted in the above image we are redirected to a SonarQube Server following is the screenshot attached of the same.
When redirected we see the above webpage (on running port of SonarQube: 9000) with a message that “No analysis has been performed since creation. The only available
action in this configuration” and the possible solutions suggested is – Either you should retry the analysis of simply delete the project.
But whereas when SonarQube Analysis is run on the local repository on the project name Sample Project using command line(terminal command of "sonar-scanner") the analysis gives the results as required when ran on a sample java code this can be demonstrated by following screenshots:
Can someone help is there any special step to integrate Bitbucket server with Sonarqube to resolve above problem?
First of all I assume by the gui, that you are using mibex software sonar4stash plugin, please consider this in my answer
This Plugin is not doing any sonar analysis, it is just the gateway between bitbucket and sonar. Although the plugin is able to provision your sonar project - setting the quality profiles, and the quality gate which should be used. But it is not able to do an analysis.
For the analysis you have multiple options:
- you do it manually on each machine (not ideal)
- you do it with a post receive hook on the bitbucket server (also not ideal, because you have to have sonar scanner on it etc.)
- and that is the most common usage, you have a build system which is triggered by bitbucket - mibexsoftware offers a great documentation for that, how to configure it.
Solution number 3, can cause a lot of builds to be triggered, and i recommend to also investigate into pull-request-notifier as a way to trigger those analysis via a button and on certain occasions (we are doing this on PR-Open, PR-Reopen and button trigger)
So i highly suggest, to read the documentation of the bitbucket plugin - and if that is suitable for you, you want to maybe checkout the pull request notifier plugin.
Additional sidenote:
On the build system you can normally choose what you prefer to analyse your project. eg. if you want to use gradle, maven or even a plugin directly for the Build system. I just want to recommend to use local available build tool too, because this makes it easier to debug and to setup.