Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing project.properties file to sonar-scanner

i have multiple projects in one solution file. and need to build 3 projects in one pipeline and two projects in another pipeline of CI. So in order to have code analyzed using sonarqube, i found that using two project.properties file and by running sonar-scanner command in the directory of the solution file as well as the properties file serves the issue.

this is working if i include 3 projects in one sonar-project.properties file. because im not passing any arguments along with sonar-scanner it is picking default properties file i.e., sonar-project.properties . if i rename it and create another properties file for the other pipeline, i need to pass the arguments as

sonar-scanner -Dproject.settings=../myproject.properties

but it is not recognizing the properties file. Please help.

I followed this link: https://docs.sonarqube.org/display/SCAN/Advanced+SonarQube+Scanner+Usages Sonarqube version = 6.8 pipeline in TFS 2017. MSBuild version 15.

Thanks in advance.

like image 764
Kaushik Kv Avatar asked Dec 06 '25 04:12

Kaushik Kv


1 Answers

When you try to pass the sonar properties file through the argument project.settings do you have also a file named sonar-project.properties in the analysis folder? If so you have to rename it in order to use the project.settings argument.

I have noticed that if a sonar-project.properties file already exists, the file pass through the project.settings argument is not taken in to account.

Instead of using .properties files, an other option to only analyze specific projects is to use MSBuild conditionnal exclusion in csprojs. The complete description is available at : https://github.com/SonarSource/sonar-.net-documentation/blob/master/doc/appendix-3.md

like image 94
Alban Avatar answered Dec 08 '25 15:12

Alban



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!