Fix SonarQube "indexed twice" error for dispatcher-agent sources#763
Merged
Conversation
…subproject
The SonarQube Gradle plugin v6+ auto-detects JVM subproject source sets.
Having dispatcher-agent paths in BOTH the root sonar {} block AND the
subproject's auto-detected sources caused:
"File ... can't be indexed twice" (Issue #762)
Fix:
- Remove dispatcher-agent/src/{main,test}/kotlin from root sonar.sources/
sonar.tests and java binary paths in build.gradle.kts
- Add explicit sonar {} block in dispatcher-agent/build.gradle.kts that
claims src/main/kotlin and src/test/kotlin for this module
- Update sonar-project.properties to include dispatcher-agent paths for
consistency with CLI sonar-scanner runs
Copilot
AI
changed the title
[WIP] Fix SonarQube analysis: file indexed twice error in dispatcher-agent
Fix SonarQube "indexed twice" error for dispatcher-agent sources
Jul 12, 2026
bedaHovorka
approved these changes
Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SonarQube Gradle plugin v6+ auto-detects source sets for every Kotlin JVM subproject. With
:dispatcher-agentpaths also explicitly listed in the rootsonar {}block, the scanner encountered the same files via two paths, causing:Changes
build.gradle.kts(root): Removedispatcher-agent/src/{main,test}/kotlinfromsonar.sources/sonar.testsand remove dispatcher-agent binary paths fromsonar.java.binaries/sonar.java.test.binaries. JUnit/JaCoCo aggregation paths stay in root. Added comment explaining the invariant.dispatcher-agent/build.gradle.kts: Add explicitsonar {}block that owns this module's source/test/binary configuration — the correct multi-module Gradle pattern where each subproject declares its own SonarQube settings:sonar { properties { property("sonar.sources", "src/main/kotlin") property("sonar.tests", "src/test/kotlin") property("sonar.java.binaries", "build/classes/kotlin/main") property("sonar.java.test.binaries", "build/classes/kotlin/test") property("sonar.sourceEncoding", "UTF-8") } }sonar-project.properties: Adddispatcher-agentpaths to keep this file in sync (used for local CLIsonar-scannerruns, which have no Gradle subproject auto-detection).