I encounter issue to configure a multilevel maven modules for Sonar Analysis.
It is working fine with the following structure:
parent module
|- level 1
|- module with code to analyze
But if I add a depth to the module with code to analyze, I'm not able to configure it.
parent module
|- level 1
|- level 2
|- module with code to analyze
I tried several configurations:
Can not execute SonarQube analysis: The project 'level 2' is already defined in SonarQube but not as a module of project 'level 1'. If you really want to stop directly analysing project 'level 2', please first delete it from SonarQube and then relaunch the analysis of project 'level 1'.
error. I don't want to launch on level 1 because I have my integration tests at the same level, directly in parent module.Does someone has an idea on how to handle it? (I mean without to modifying the hierarchy folder which is really helpful for some other requirements)
Thanks by advance
I found a workaround: - I launch mvn clean install on parent project - then I launch sonar:sonar at 'level 2' module, I can do it because all the code source to be analyzed is under the same module.
At least it is working on my sample project but currently I didn't handle yet to make it working on my real project.
Building my Maven multi-module project is consistently working for me. I'm using SonarQube v4.3.
I placed a sonar-project.properties file at the root level of the parent Maven project.
Here's the contents:
# Root project information
sonar.projectKey=<I used the project pom's groupId + artifactId>
sonar.projectName=<can be anything>
sonar.projectVersion=<I used the project pom's version>
# Some properties that will be inherited by the modules
sonar.sources=src
In my parent project's pom, I declared this property:
<sonar.language>java</sonar.language>
Within the same pom, I declared the following:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
I'm building only the parent project, which results in the parent and all of its children getting analyzed by SonarQube. I'm using:
mvn clean install sonar:sonar
or
mvn sonar:sonar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With