Can't be indexed twice

scanner
sonarqube

(Nitish Goel) #1

Hi,

I’m seeing an issue “can’t be indexed twice”
I have excluded the test folder but still gets this issue. I think this issue is because of the same file is referenced twice. Is there anyway I can find what all files are referenced twice?

Every time I see a new file causing the same issue or what is the better way to handle this error?

Thanks,
Nitish Goel


(Nicolas Bontoux) #2

Hi,

Reviewing debug logs of the analysis seems like a good starting point. Use sonar.verbose=true, and you’ll get to see precisely how each files are indexed, and narrow-down potential overlaps.


(Nitish Goel) #3

Thanks, Nico.

I’m not sure what’s wrong here. I enabled the debug mode and i see a same file is referred twice in the logs.
Is this an issue because of any configuration of the sonar? both files referring to the same path, so i don’t believe they are duplicates, instead something wrong in config and so its doing it twice?

for example
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/DHCPPacket.java’ is detected to be ‘java’ 13:15:54 13:15:54.303
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/DHCPOption.java’ is detected to be ‘java’ 13:15:54 13:15:54.305
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/Lease6Filter.java’ is detected to be ‘java’ 13:15:54 13:15:54.306
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/DHCPOptionDefinition.java’ is detected to be

13:15:54 13:15:54.428
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/DHCPPacket.java’ is detected to be ‘java’ 13:15:54 13:15:54.428
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/DHCPOption.java’ is detected to be ‘java’ 13:15:54 13:15:54.428
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/Lease6Filter.java’ is detected to be ‘java’ 13:15:54 13:15:54.429
DEBUG - Language of file ‘ddi-ng/destiny/cnr-sdk/java/com/cisco/cnr/sdk/dhcp/DHCPOptionDefinition.java’ is detected to be


(Nicolas Bontoux) #4

Without the entire set of logs it will be hard to determine what’s at the origin of the duplicate. At the same time I see you’re working on proprietary code here, keep in mind that this forum is public, and consider commercial technical support if you need more private assistance.

One thing you can check is whether you’re setting sonar.sources with the Scanner for Maven. The latter is handling file analysis automatically (based on Maven project definition), you should not be specifying sonar.sources on top of it.