Incomplete documentation for gradle multi-module project

310 views
Skip to first unread message

Mark Gortzak

unread,
Sep 15, 2017, 6:47:40 AM9/15/17
to SonarQube
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

G. Ann Campbell

unread,
Sep 15, 2017, 7:35:48 AM9/15/17
to SonarQube
Hi Mark,

Thanks for reporting this. I'm glad your Google-fu was strong enough to find you an answer. :-)

Rather than documenting this internal property, we'd like to solve the issue directly, so we've created SONARGRADL-44 to handle modules with ".." in their paths. If this is a misunderstanding of your situation, please let me know.


Ann

Mark Gortzak

unread,
Sep 15, 2017, 8:08:13 AM9/15/17
to G. Ann Campbell, SonarQube
Hi Ann,

Thanks for the fast response.

No, solving this directly in the Gradle plugin is fine by me :-).

Greetings,
Mark

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/WR726lPeLXk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/b80b3b32-173e-49a6-b603-31026c59081b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages