Exclusions should work the same way in your PR analyses as they do in your main branch, assuming the exclusion is configured the same way and there’s been no major change in how your files are organized.
You can double check this by adding --info to your gradle sonar command.
Preprocessing files...
1 language detected in 2 preprocessed files
1 file ignored because of inclusion/exclusion patterns
...
Indexing files...
Project configuration:
Excluded sources: **/build-wrapper-dump.json, **/test/**
Do you see any differences between your PR build and your main branch build?
This could be another redherring, but your original post listed the exclusion as:
But your most recent post
(different file path, generated vs generatedclients)
That’s why I recommend you check the logs to make sure you’re passing the same exclusion.