File can't be indexed twice


I am experiencing the below issue in the project I am working on (using SonarCloud).

“File bundles/net.tourbook/src-test/net/tourbook/weather/ can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files”

I have followed the official documentation without any success.

Here is my sonar properties, note that I am using the test.inclusion and exclusions following the doc, can you please advise ?

 property 'sonar.sources',                        'bundles/'
    property 'sonar.tests',                          'bundles/'
    // Include test subdirectories in test scope
    property 'sonar.test.inclusions',                'bundles/*tests/**/*.*, bundles/**/src-test/**/*.*'
    // Exclude test subdirectories from source scope
    property 'sonar.exclusions',                     'bundles/*tests/**/*.*, bundles/**/src-test/**/*.* '

FWIW, I noted that in my build logs, some entries are duplicated !?

Notice how the two exclusions appear twice:
**bundles/*tests/**/*.*, bundles/**/src-test/**/*.***

2023-09-20T19:27:39.5842059Z Excluded sources: **/build-wrapper-dump.json, **bundles/*tests/**/*.*, bundles/**/src-test/**/*.***, bundles/net.tourbook.ext.jars*/**/*, bundles/net.tourbook.model/map-models/**/*.*, **bundles/*tests/**/*.*, bundles/**/src-test/**/*.***


I think maybe test inclusions are automatically added to source exclusions(…?).

But that’s probably a red herring.

Can you provide your full analysis configuration and your analysis logs, starting from the analysis command?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.