Multiple build wraper output integration in sonarqube analysis

We are utilizing SonarQube Developer Edition Version 9.9.1 for conducting C and C++ code analysis within our project structure. Our project comprises three subdirectories: pmhttp, nextgenads, and FastCGI_AdServer, each requiring distinct compilation and unit test execution commands.

Currently, when executing separate analyses for each directory, SonarQube provides proper analysis results. However, when attempting to integrate these results, we encounter issues where the Build Wrapper output from one directory overrides that of the next, preventing us from achieving an integrated analysis across all directories.

Could you please advise on the appropriate Sonar Scanner command to ensure a comprehensive analysis across all directories while avoiding the issue of Build Wrapper output override?

Hey there.

I think you really have 3 options:

  1. Have a separate SonarQube project for each build. You can stitch these back together with an Application if you want aggregated reporting.
  2. Wrap your three build commands in single bash script, and then execute the build wrapper pointing to that script (which builds all 3 of your projects). This will capture all the compilation commands for all the projects, and then you can pass a single build wrapper output to the scanner (and only run the scanner once).
  3. SonarQube v10.6 supports AutoConfig, a very accurate analysis which does not require a build (or use of the build wrapper).

Second option I tried by keeping build cmd of three folder in bash script,
But sonar scan pickup latest folder only, in this schenario analysis of 1 st and 2nd folder overiding by 3rd folder.

I’d have to see the exact commands you’re running, the bash script, and the analysis logs to understand more.