Setup SonarQube server on local machine using Docker image.
Configured Sonar parameters with our projects requirements. Also setup Sonar.Sources property with multiple module/projects.
It should scan both project or modules as we have already using same setup on Azure DevOps Pipelines, but it is overwriting the first source path code with second source path code.
We’re only getting single project code in SonarQube server in code tab.
For more details please check attached screenshots and code snippets.
Here, in above 3 screenshots, first image shows live working example of same project having 2 module(common and snaplot). In 2nd and 3rd image, you can see first module scan code gets overwritten after second module scan which should not happen.
Analyses are not additive. To get all your code reflected in SonarQube together, you’ll have to analyze it together.
If, for some reason, your modules cannot be built and analyzed together - and this would be unusual - then you should give each one a unique sonar.projectKey so that at least they don’t replace each other in the same project.
Yes, using a unique sonar.projectKey that is possible to analyze the code. But can’t we use same projectKey for both module which are part of single project. It’s already configured in Azure pipelines but I’m not able to achieve it using gradle file.
For Java analysis, you need access to both the source and the byte code.
So if all the code is built in the same pipeline, you can absolutely analyze it all together. in fact, that’s the default. How are you running analysis that only one module is being analyzed at a time?