"Sonarcloud" doesn't exclude the sources from sonar-project.properties file

Dear Team,
Currently facing a challenge where files are not getting excluded even though they are added in the “sonar.exclusions” withing sonar-project.properties file.

Infra basic details:

  • ALM used - Github

  • CI system used - Jenkins

  • Scanner command used when applicable (private details masked)

  • Languages of the repository - Javascript, TypeScript

  • Only if the SonarCloud project is public, the URL

  • Observation - Sonarcloud doesn’t exclude the defined files and folder in “sonar.exclusions” property.

  • Steps to reproduce:

  1. Create a “sonar-project.properties” file in the Github repo.
  2. Set the sonar.exclusions=temp/*,seed.js
  • Potential workaround - When I do the same configuration within the Sonarcloud dashboard then it works as expected. (Administration -> General Settings -> Analyze scope -> Set the value in sonar.exclusions)

Expectation - Since we have to exclude the un-wanted source in many projects so doing the same through the Sonarcloud dashboard will be a bit difficult. Hence we want to achieve this through the “sonar-project.properties” file. This works well when I was using the “Sonarqube” dedicated server.

Request you to help with the above request.

Many thanks in advance.

1 Like

I’m having the same problem with ‘sonar.cpd.exclusions’ property.
Adding ‘sonar.cpd.exclusions’ to the sonar-project.properties file with a value of ‘**/someFile.tsx’ doesn’t exclude the someFile.tsx from code duplication analysis.

After some googling, I have found the below solution and it worked perfectly fine for me.


  1. Replace the sonar-project.properties to .sonarcloud.properties
  2. Added the same set of configuration that I had used in the sonar-project.properties file.
  3. Perform the scan analysis through “Sonarcloud”.

Result: It has excluded all the file/folder that I had mentioned in the .sonarcloud.properties file.

Learning: It seems Sonarcloud looks for .sonarcloud.properties file instead of the sonar-project.properties file. I am sure this might have captured in the documentation but unfortunately whatever I have read so far couldn’t see this step.

A clue that triggers to above solution was from this source: SonarCloud sonar.exclusions not working still/again

Happy Learning!

1 Like

changing the file name works for me as well. thanks for the research.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.