The SonarScanner gradle plugin is currently limited, as it only scans subprojects that are located directly at the root. However, Gradle allows projects to be embedded within other subprojects. We can see the limitation in the SonarScanner code here:
https://github.com/SonarSource/sonar-scanner-gradle/blob/ee27aa49577c1cb29c093668696c45c959bd2822/src/main/java/org/sonarqube/gradle/SonarPropertyComputer.java#L118 and at line 122.
It is using the getChildProjects() method, but according to the Gradle API, this only gets direct subprojects. It should therefore use getAllProjects() so that it will recursively get all subprojects in the repository.
Some testing will be required to make sure that these are the only code changes required. These changes only control which projects are put in the “sonar.modules” property, so some investigation is required to make sure that projects are loaded properly to support deeper subprojects.