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.
Another configuration option is adding a maven properties
sonar.exclusions
. Below is a sample pom file with exclusions of static jquery directory and static pdf viewer directory.Try something like this:
If we want to skip the entire folder following can be used:
And if we have only one particular file just give the complete path.
All the folder which needs to be exclude and be appended here.
I able to exclude multiple directories using the below config(comma separated folder paths)
And while running the sonar runner I got the following in the log
Just to mention that once you excluded the files from Sonar, do the same for Jacoco plugin:
This will work for your case: