Sonar exclusions from the project configuration are ignored

I’m using sonarqube 9.0.1.46107 and a jenkins server where I’ve installed sonar-scanner

The project has this configuration on the server

The command I use for the scanner is:

sonar-scanner \
  -Dsonar.projectKey=$PROJECT_KEY \
  -Dsonar.host.url= <my server>
  -Dsonar.login= <my key>
  -Dsonar.sourceEncoding=UTF-8 \
  -Dsonar.projectVersion=$PROJECT_VERSION \
  -Dsonar.branch.name=$BRANCH

But when I check the console I always get other excluded files

I don’t understand why some of the settings are retrieved and used from the server while the exclusions setting is not used from there. Am I missing anything ?

Hi,

Welcome to the community!

It’s not clear from your last screenshot whether the exclusion list used in analysis is instead of what you’ve configured or in addition to. Can these unexpected exclusions be files ignored by your SCM? From the docs:

For supported engines, files ignored by the SCM, i.e. files listed in .gitignore , will automatically be ignored by analysis too.

If that’s not the case, then do you have a sonar-project.properties file in your project? If so, it will be picked up automatically & its values will override anything set at the server. That docs reference I gave you^ explains the settings hierarchy.

 
HTH,
Ann

The exclusion list from my last screenshot is used instead of what I’ve configured on the server. I’ve checked the ignored files and I don’t have anything like that. Currently, the project doesn’t have a sonar-project.properties file, I was hoping to configure everything on the server. Worst case if I can’t make it work like that, I’ll move the settings in a file, but I want to know first if there are any other solutions.

Hi,

Okay, then we need to figure out where it’s coming from. The hierarchy of parameters is explained in the docs and parameters set at a lower level override those set at a higher level (so in retrospect, I’m not sure why I asked whether the exclusions were in addition to or instead of :roll_eyes: ).

So then the thing to do is figure out where that configuration is coming from. That same docs link will give you the places to look.

 
Ann