How to Apply Sonar Runner to Multi-Project Hierarchies with Code in the Root Project?

Not sure if anyone has overcome this hurdle yet, but we use Oracle Commerce (ATG) and by default all its software is packaged in a multi-module hierarchy with source in the root and sub-parents. Traditionally customisation follows the same pattern. As of SR 2.4 and Gradle 2.2.1 the problem still exists with Gradle correctly generating the sonar properties according to its model but invalid for Sonar which still only supports leaf nodes with source. So the first steps I’ve taken are: 1. Hand crank the sonar-project.properties in the project root and run the runner manually. This uses the pattern of making all modules appear to be leaf-nodes, even the root. This works without errors. 2. Generate the default gradle build and copy the generated properties from build/tmp/sonarRunner/sonar-project.properties into the root. a. Remove all sub-module modules settings and modify the root’s to include all the individual modules plus a new one for the root. b. Copy the root (default) block of settings and give it a prefix as per the project name (and the new module added to modules) c. Strip all source related properties from the default root settings d. Set the name of each module’s projectName to the pattern .Parent.Child, e.g. Common.Datamanagement.Versioned e. Run the runner manually against this file and it all works and the Sonar dashboard breaks the code down into the modules as I want to see them. We could actually live like this but running the sonar runner manually in CI instead of the gradle task and modifying it each time the project dependencies/structure changes is too cumbersone and error prone - but at least a fallback option if necessary. Now the challenge is to get Gradle to generate the same … If I crack it I will add it back here :slight_smile: