Scanning from an hierarchical directory - Sonar Scanner

SonarQube version: 6.7.7
Hi, I am new to sonarqube and its functionality.
I want to know if the sonarqube is capable to achieve scanning of file within another file.
So let’s say if I have a project main folder called A and within that I have other subfolder project1,project2,project3,project4,…,project_n
and then within those I have subproject
p1,p2,p3,p4,…pn and they contain the java source code and java junit test.
How can I run gradle sonarque that will go through the folder and only run the source code while ignoring the the test.
Note: I have an sonar exclude statement that is pointing to the test file.

Thank you for your feedback


It’s not clear why you want to ignore the tests. Is it because you don’t want issues raised against them? If so, then you’re in luck! “Normal” rules aren’t run against tests, however there are a few test-specific rules that are.

To ensure this treatment, you just need to either make sure your tests are stored where Gradle expects them to be by default, or that you’ve set sonar.tests to point to the right place.

If you really want to fully exclude your test files, though, you can set up exclusions to omit them entirely from analysis.