Multiple/Aggregate SonarScan analysis using singe project key for a project


SonarQube server 8.9.7
CFamily plugin version:

I am working on a single large repository. As part of our Jenkins pipeline, we are needed to run SonarQube analysis as part of two separate stages, which both of them are executed in parallel.

Both stages use different file, but reference the same project key.

With this setup, the behavior we have observed that whichever analysis is completed later, it overwrites the previous stage’s analysis.

One important thing to note here is that there is no overlap of code being built between both the analysis.

We are using nested files. One file in present in the root directory of the project. The second properties file is present in one of the sub-directories 3 levels down from the root (root->Main->Lib->source).

I have excluded the root directory for the second properties file (source) from the first properties file. I have achieved that using sonar.exclusions property.
eg: sonar.exclusions=Main/Lib/source/**

This is what the overall structure looks like:

code-repository root
 |           |---------Lib
 |           |               |---------source
 |           |               |          |----------sonar-project-properties

Is there a way, we can achieve aggregated analysis for our project? What steps should we follow to get the full analysis show on the server?

Hey there.

The results of one scan targeting a project key will always overwrite the previous scan.

If you absolutely have to keep the scans separate, you might consider using separate project keys and an Application to aggregate the information.

Thanks Colin! We’ll try to implement this “Application” feature.

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