Change Module Directory Path on SonarQubeUI

I think there is a misunderstanding due to the difference between Gradle subproject hierarchy, and physical folder layout.

For now, SonarQube has a concept of modules (that originally comes from Maven FYI) that is a logical view. It is not related to how your folders are structured, but instead how your declare your subprojects in Gradle.

Example:
Let say your physical layout is:

  • folder1
    • folder11
    • folder12
  • folder2
    • folder21
    • folder22

But if you root settings.gradle contains:

include 'folder1/folder11'
include 'folder1/folder12'
include 'folder2/folder21'
include 'folder2/folder22'

Then in SQ you’ll end up with 4 flat modules:

  • folder1/folder11
  • folder1/folder12
  • folder2/folder21
  • folder2/folder22

If you want to mimic the folder hierarchy, you can change your Gradle config by (note that ‘/’ are replaced by ‘:’):

include 'folder1:folder11'
include 'folder1:folder12'
include 'folder2:folder21'
include 'folder2:folder22'

It will make Gradle understand that folder11 is a subproject that is a child of folder1.

And it will also solve your issue of having ‘/’ in module keys.

The good news is that we are working on dropping the concept of modules in SonarQube, and replace it by a hierarchical folder layout. You can follow progress here:
https://jira.sonarsource.com/browse/MMF-365