SonarQube Exclude a directory

user1982350 picture user1982350 · Jan 24, 2014 · Viewed 187.1k times · Source

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.

Answer

Juan Hernandez picture Juan Hernandez · Jul 26, 2015

Try something like this:

sonar.exclusions=src/java/test/**