Exclude directory from SonarQube analysis

I’ve connected the IDE plugin to SonarQube cloud. I want to exclude all the files in src/main/java/db/schema when I trigger analysis manually in the IDE, and when the files are analysed in the cloud (i.e. when a PR is opened on GitHub)

I’ve added a .sonarcloud.properties file to my project root with the property:

sonar.exclusions=src/main/java/db/schema/*

But when I manually trigger the SonarQube analysis in the IDE, violations in these files are reported.

  • Operating system: macOS
  • SonarQube for IntelliJ plugin version: 10.16.1.80464
  • IntelliJ version: 2024.3.2.2
  • Programming language you’re coding in: Java
  • Is connected mode used: SonarQube Cloud

Hey there.

No .sonarcloud.properties file needed here. Take a look at the SonarQube for IntelliJ docs on file exclusions!

Thanks for your help. I want the exclusions to apply both in the cloud and locally (in IntelliJ). If I follow the instructions in File exclusions in the IDE, they will only apply to the latter.

Ideally, I would like the exclusions to be defined via a file in the project, rather than buried in the settings of either the IDE or SonarQube Cloud.