How to include multiple files (around500) from different sub directories in sonar.inclusions

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube version 9.5, Scanner 4.7
  • what are you trying to achieve
    I am trying to scan multiple files form different sub directories of a project, which are updated in the latest commit using sonar.inclusions argument
  • what have you tried so far to achieve this
    I tried with just 1 files from different sub directories to be included in the scan using the following command sonar.inclusions=**/

But, this command is looking for all the files with these names and gave me 2 files with that name in 2 different locations.

Now, I want to know how to avoid the duplication of these files. How to specify the path (OR) how to point the sonarScanner just to that specific file.
If I want to specify the path of the file in the same argument, how to write it
For example the path is “/home/oracle/V12/AP/CTL/BPVendorsLOVAction.Java”

And how many maximum number of files along with path can be included in this argument of scanner command.

Please let me know the best way to do this.

Thanks in advance


You can start your path spec from analysis / project root. No need to start from box root.

This is not something we’ve tested, since your use case was not anticipated. I suspect this is going to be a question of string length rather than file count, but that’s speculative.

Would you mind sharing why you want to do this?


Hi Ann, thanks for the reply.

I want to able to pickup let’s say if there are more number of files in a specific commit, and I want to scan only those files not everything in the project directory. So, I want to point the scanner only to those files, without having duplication.
In this case, if we are to mention around 500-1000 files along with their path in sonar.inclusions, I am not sure how to get this done.
I really appreciate, if you have a specific, preferred/recommended way of doing this.



Starting in Developer Edition($) you can analyze your PRs. In the last few months we’ve made strides in narrowing PR analysis to only the changed files and we will continue to expand this functionality through the rest of the year.

But I have to ask: you really have single commits that include 500-1k files? Have you considered working more granularly?

Because inclusions just weren’t built to do what you’re trying to do.


Hi Ann,

The question is not about analyzing the PRs. I want to know maximum capacity (pointing to path specific files) of the sonar.inclusions argument in scanner command. Because, I have already tried the same with around 3-400 files and it was successful.

But my question is do you know any limitation for that number?
Or you want me keep trying by increasing the number of files.
Please let me know.



I don’t know of any limits.

Do you really have single commits that change 500-1000 files?


I don’t know the exact number but we have more number of files for some commits.
And it’s not because of commit, but some time we need to scan specific files from different locations. That is why I am curious to know how many files we can include using this sonar.inclusions argument.