SonarQube Exclude a directory
I am trying to exclude a directory from being analyzed by Sonar. I have the following properties defined in my sonar-project.properties
file:
sonar.sources=src/java
sonar.exclusions=src/java/test/****/*.java
The directory structure I have is:
src/java/dig
src/java/test/dig
When I run the sonar-runner I get the following info:
INFO - Excluded sources:
INFO - src/java/test/**/*.java
INFO - Excluded tests:
INFO - **/package-info.java
But when I check the result of the analysis all the packages inside the test directory are still there.
I just need to tell Sonar to not analyze the test directory and any packages inside it.
Solution 1:
Try something like this:
sonar.exclusions=src/java/test/**
Solution 2:
I'm able to exclude multiple directories using the below config (comma separated folder paths):
sonar.exclusions=system/**, test/**, application/third_party/**, application/logs/**
And while running the sonar runner I got the following in the log:
Excluded sources:
system/**
test/**
application/third_party/**
application/logs/**
Solution 3:
This will work for your case:
sonar.exclusions=**/src/java/dig/ ** , **/src/java/test/dig/ **