Trying to exclude a directory from scans as follows (in every project)
The setting doesn’t seem to have any effect. SonarScanner still complaining about the files under excluded directory.
However, if we exclude the same pattern at project level in sonar-project.properties then the warnings disappear as expected. We would like to exclude the pattern globally for every project.
Could you please check if the exclusion is being loaded by the scanner? There should be a log entry:
[INFO] 15:15:25.937 Indexing files...
[INFO] 15:15:25.937 Project configuration:
[INFO] 15:15:25.938 Excluded sources: **/*.java
Next is to check what files are getting indexed. That is shown with debug logs enabled.
Finally, the number of excluded files is logged as well in INFO:
[INFO] 15:15:26.057 9 files ignored because of inclusion/exclusion patterns
When defining it in the sonar-project.properties, what property key did you use?
I just did a quick test and files excluded with the global property defined on the server aren’t getting blamed.
This is the global config
This is what I see in logs
To get it working I added **/allure-results/* in
I’m not sure which one of them actually solved the problem.
Hey. Any updates on this issue, Duarte Meneses?
Hi @ragnarpa ,
Since you got it working I thought the topic was “closed”.
Looking at the logs when you have the global exclusions set, it looks like
sonar.global.exclusions is being overwritten with a different value. Maybe this is being done in the scanner side, in the
sonar-project.properties or in the build systems configuration? Properties don’t get merged if they are defined multiple times in different places.
Hey. There is clearly something broken. The SonarQube UI says following
“They apply to every project and cannot be overridden.”
So my expectation is that sonar.global.exclusions get merged with project local settings which apparently isn’t the case although the UI says that global settings can’t be overwritten.
Is there another channel where I can report this problem? We are a paying customer.
Perhaps the wording in the UI is too strong. Global exclusions are not overridden by
sonar.exclusions. Probably your
sonar.global.exclusions value was overridden by a value set for that same key at another level..
That’s what I meant -
sonar.global.exclusions is probably being overridden elsewhere by the same property defined on the scanner side. The solution is to change the scanner configuration and use
I created a ticket to either fix the behavior or clarify the documentation and labels: [SONAR-17305] - Jira
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.