Java Project is not getting analyzed in Enterprise Sonar Scanner

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
  1. Enterprise Edition: Version 8.5.1 (build 38104)
  2. Community Edition: Version 8.5.1 (build 38104)
  • error observed (wrap logs/code around triple quote ``` for proper formatting)
    The project can be analyzed fine in Community edition docker Sonarqube.
    The same project , In the enterprise version the error says “The main branch of this project is empty.”
    The analysis result has 0 Bugs, 0 Vulnerabilities.

Hi @sohmukhe,

Welcome to the SonarSource community!

There are many possible errors you should check for:

  • Did you scan the main branch for each scan (of each SonarQube instance)?
  • Are all your source files being included? Did you exclude too many files?
  • Are all the sonar properties matching between the SonarQube instances?
  • Did you pass extra parameters that you didn’t mean to?

In any case, can you please post the Sonar scanner debug logs for the Community Edition scan and the Enterprise Edition scan?

  • If you use Gradle, you can pass --debug as in ./gradlew clean build sonarqube --debug
  • If you use Maven, you can -X as in mvn clean install sonar:sonar -X
  • If you use SonarScanner CLI, you can run append -X as in sonar-scanner -X

Joe

Yes I have scanned the main Branch and source files are included. No files excluded.

Sonarqube Version

  1. Enterprise Edition: Version 8.5.1 (build 38104)

Error observed:
When I click the project, it doesn’t display anything in the Overview but gives an error message
“The main branch of this project is empty.”

In the WebInspector I see the error:

Failed to load resource: the server responded with a status of 403 (Forbidden) for Sonarserver/api/measures/component

Debug Logs

Debug_Logs.txt (56.0 KB)

Hi Sohini,

The Sonar scan analysis for your maven project looks fine: [INFO] 10:53:55.686 3 files indexed and it completes successfully. No other unusual warnings or errors.

Can you try the following or answer these questions?

  1. Upgrade sonar-maven-plugin to 3.7.0.1746
  • You are using an old version 3.6.0.1398. This won’t fix your issue necessarily, but it will help keep your tool chain up-to-date.
  1. Let’s make sure that it is SonarQube that is returning the 403 error (and not another layer, such as the proxy sitting in front of your server). Could you make sure that one of these failures has happened recently, and zip your $SONARQUBE_HOME/logs/ directory? Please attach on your next response.

Joe

Here’s another idea (long shot). I see that master was analyzed. Is that the name of the main branch of the project or is master available under branches?