Hi all,
I tried analyzing a Gradle multi-module project with Gradle following the documentation:
Running it out of the box I got this error:
"nxs-store-service:../interface" is not a valid project or module key. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.
Which was fine, I just had to change the identifier. I read this piece of the documentation:
The "sonar.projectKey" is defined as "[$project.group:]$project.name for root module <root module key>:<module path> for submodules".
Okay, easy!
project("../interface") {
sonarqube {
properties {
property "sonar.projectKey", "${rootProject.name}:store-interface"
property "sonar.projectName", "$group/${rootProject.name}:store-interface"
property "sonar.projectVersion", baseVersion
}
}
}
Too bad, still an error :-(. Some further Googlefu gave me a hint, the sonar.moduleKey:
project("../interface") {
sonarqube {
properties {
property "sonar.moduleKey", "${rootProject.name}:store-interface"
property "sonar.projectName", "$group/${rootProject.name}:store-interface"
property "sonar.projectVersion", baseVersion
}
}
}
And it works! :-)
But the weird thing is, and which is the subject of this post, is the property "sonar.moduleKey" is mentioned no where on the entire SonarQube Confluence:
So could someone please update the documentation regarding Gradle multi-module project? Might save someone else some searching.
tl/dr: For a Gradle multi-module you need to use the undocumented "sonar.moduleKey" if your submodule needs a different key.
With regards,
Mark Gortzak