File cannot be indexed twice

Hello Team,

I have the following directory structure:
Project A β†’ Src , resources (containing files: beans.xml, beans.xsd), TestSrc

Under resources directory I have dirA (containing files: test, testclasess.xml)

I defined the following properties:

sonar.tests=testsrc/,resources/  (also tried defining only testsrc/)


I receive the error that testclasses.xml cant be indexed twice. Same with other file under resources for beans.xml, beans.xsd.

Please advise on how to fix this issue.

Hey there.

What language(s) are you analyzing?

Hello @Colin ,

We have java, xml, xsd, css files.

Use ant to build the project.

Thanks and Regards

Thanks. Keep in mind two things:

If you’re using the SonarScanner for Ant, it has been deprecated and you’ll need to migrate (as documeted) to the SonarScanner CLI.

If you’re already using the former, then it’s time to look at how the analysis parameters are configured.

When I analyze a project like this:

β”œβ”€β”€ resources
β”‚   β”œβ”€β”€ dirA
β”‚   β”‚   └── testclasses.xml
β”‚   └── sourcexml.xml
β”œβ”€β”€ src
β”‚   └── Person.js
└── testsrc
    └── Cat.js

Using the file you shared



I get a successful scan. testsrc needs to be added to sonar.test.inclusions to correctly index the files as test code, but otherwise it functions well. Am I missing something in trying to reproduce it?

Can you also mention what version of SonarQube you’re using?

Hello @Colin

Thanks for the help.

Figured out that these files were being scanned twice and hence we were receiving the error. This is now resolved.

Thanks again !!

1 Like