Sonar-scanner for multiple languages in one SQ project

  • SonarQube 8.4.2.36762

  • I have an application developed with 4 different languages/scripts namely C#, C++, Java and Angular. Can I create 1 project in SQ to analyze all the languages using sonar-scanner? or should it be split into multiple projects as

  • C# - Using SonarScanner for MSBuild 4.8

  • C++, Java and Angular - Using sonar-scanner

  • sonar-scanner does not analyze C# project and as per documentation need to use MS-Build. When I run sonar-scanner and MSBuild in one build script process and assign the results to same sonarqube project, only one language result is updated (overwritten with last language processed without appending it)

Please help me with an appropriate answer.

Hi Ravi, welcome to the SonarSource Community!

You’re right in guessing that the SonarScanner for MSBuild will need to be used. Additionally, for the C++ code, the build-wrapper will need to be used as well.

Angular is no problem; the javascript or typescript files involved could be picked up as part of the same scan as the SonarScanner for MSBuild will detect.

The challenge is the Java code. How is it built? Is Maven or Gradle involved? It may be easiest to separate this code to another project and use the appropriate scanner for the build type in order to analyze it.

You didn’t mention which edition of SonarQube you’re running. If it’s Enterprise Edition (or soon coming to Developer Edition), the Applications feature may be used to create a synthetic project to see all the results from these multiple scans together within SonarQube.

Dear Jeff

Thanks for the quick response.

Java code is built using Ant and plan is to use sonar-scanner.

We are using Developer edition to start and yes as you said Application feature will be useful for us and will upgrade to enterprise in future.

Thanks again for your response, we are able to proceed now with this understanding.

Hi Jeff,

Any ideas when the Applications feature is coming to the Developer Edition? In pretty much the same boat so that feature would be really useful for us :slight_smile:

Thanks!

Hi @lawrence – it’s already happened and was included in SonarQube 8.6.

1 Like