How to configure multi-module Gradle project to avoid "can’t be indexed twice" issue?

Hello @Alix,

When you’re using scanner for Gradle, usually you don’t need to override sonar.sources properties it should be populated automatically.

In version 4.4 all the .gradle.kts files are added to the root project sources. When you add these files to the submodules, you force them to be indexed twice.

FYI, it was done on purpose, as analyzing rules for Gradle Kotlin DSL requires a connection to Gradle API and it is very slow, so the decision was done to putt all the files in the root module and connect to Gradle API once.

So, in your case, if you remove sonar.sources property from the submodules, the issue should disappear. Let me know, if you the issue is not resolved after this fix.

Best,
Margarita

1 Like