SonarQube Scanner 231k lines of code get's analyzed for 30minutes

The version of SonarQube Scanner is:
We are running via TeamCity SonarQube runner.

Problem is that 30 minutes spent on code analysis of 231k lines of Java code is too much for us.
Is there any way to see why it’s executing that long and can we speed it up?

Hi @Stanislav_Antic,

What version of SonarQube are you using?

Can you perform Sonar analysis locally (i.e. not on TeamCity) and see if takes the same amount of time?

Please provide debug level logs for this (you can add -X if you are using sonar-scnaner, -d if using gradle sonar scanner, or -X if using maven sonar scanner).


1 Like

We have figured out why the problem happened were set to MVN cache dir which slowed it down especially that on TeamCity agents that dir includes many other projects.
Running things locally helped me to figure out problem, thanks.

1 Like

If you are using Maven for build tool, are you using the Sonar scanner for Maven or Sonar scanner CLI? If you use Sonar scanner for Maven, is set automatically for you by Sonar plugin.

We are using SonarQube scanner through TeamCity “SonarQube Runner” plugin. There you can specify via parameters value of property, if I don’t specify I get warnings that I should set it.
Will see to maybe set it as part of Maven build, that looks better.

Thank you for explaining the plugin you are using. That is not an official Sonar scanner plugin we created so I cannot testify to its capabilities but I can tell so far that it is not optimized for your build since it’s leveraging the Sonar scanner CLI and not Sonar scanner Maven.

Try using Sonar scanner for Maven locally and you’ll see how much easier it is since you don’t have to specify or etc. Once you updated your pipeline on TeamCity, you won’t need to use the TeamCity Sonar runner plugin; you can just call mvn clean verify sonar:sonar, for example.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.