Sonar exclusions from the project configuration are ignored

I’m using sonarqube 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 \ <my server>
  -Dsonar.login= <my key>
  -Dsonar.sourceEncoding=UTF-8 \
  -Dsonar.projectVersion=$PROJECT_VERSION \$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 ?


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 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.


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 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.


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.