Sonarqube parameters for multimodule, multilanguage Maven project

Hi, I am using SonarQube Version 10.0 (build 68432) and have a Maven multimodule, multilanguage project, with below file structure

├── server (Java)
│   ├── src
│   │   ├── main
│   │   ├── tests
├── tests (Java)
│   ├── src
│   │   ├── main
│   │   ├── tests
├── frontend (Typescript)
│   ├── component
│   │   ├── apps
│   │   │   ├── submodule1
│   │   │   ├── submodule2

They are declared in the root pom.xml, I want SonarQube to pick up all of the modules, but when I explicitly add frontend/component/apps to sonar.sources, then some fictional paths are created during Sonar scan, for example ***\frontend\component\server\src\main, which crashes the scan.

When I tried to split the project in modules with sonar.modules then Sonar seems to scan server\src\main for all the modules, which are ignored, then I’m getting error about scanning files multiple times is not allowed.

How can I make it work?

Hey there.

Definitely put sonar.modules aside.

Can you confirm where you are making the changes to sonar.sources? In a pom.xml file or as a command line parameter (-Dsonar.sources=...)

Hi Colin,

I have been putting sources as command line parameter.

Thanks!

I wouldn’t reccomend doing that in this case – as it will apply to all modules (and that’s why you’re getting the funky paths).

If you have a pom.xml for the /frontend/ directory (I think when you say They are declared in the root pom.xml that means yes), you can adjust sonar.sources specifically for that module.

<properties>
<sonar.sources>component</sonar.sources>
</properties>

You’re a lifesaver Colin, that works perfectly :slight_smile:
Thanks a lot!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.