Gradle plugin 4.3.0.3225 Regression: "File application/build.gradle.kts can't be indexed twice"

After updating the SonarQube Gradle plugin from 4.0.0.2929 to 4.3.0.3225 our project analysis starts to fail:

Execution failed for task ‘:sonar’.

179> File application/build.gradle.kts can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

Our setup:

  • SonarQube 9.9.1, Enterprise Edition.
  • Relevant sonar properties (note: this is per module):
            property("sonar.exclusions", "**/BuildConfig.class,**/R.java,**/R\$*.java,src/main/gen/**/*")
            property("sonar.sources", "src/main,build.gradle.kts")
            property("sonar.tests", "src/test")
            property("sonar.coverage.exclusions", "build.gradle.kts")

Is this a known issue?

Hey there.

Yes this is a known issue.

https://sonarsource.atlassian.net/browse/SONARGRADL-126

In the meantime you can revert to v4.0 or the latest version without this issue, v4.2.1

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.