All of component name are same on sonar report

666 views
Skip to first unread message

swin...@gmail.com

unread,
Feb 2, 2016, 4:30:19 AM2/2/16
to SonarQube
HI SonarQube Service

I generated a sonar report , but I found all of component name are same, do you know the root cause? the following is some information of my project:

1. My project is maven project, it include many modules. Its pom.xml is like:

   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0

           http://maven.apache.org/xsd/maven-4.0.0.xsd">

       <modelVersion>4.0.0</modelVersion>

       <groupId>steve.test</groupId>

       <artifactId>main</artifactId>

       ...

       <modules>

           <module>../module1</module>

           <module>../module2</module>

       </modules>


   </project>


2. In jenkins we create a job and add the sonar maven plugin, then set the property of “Addition properties”, the following is its content:

        -Dmaven.test.failure.ignore=true -Dsonar.projectKey=stevetest -Dsonar.projectName=stevetest -Dsonar.java.coveragePlugin=jacoco -Dsonar.jacoco.reportMissing.force.zero=true


3. Run jenkins, generate sonar report, we found an issue. This maven project includes two child modules(module1, module2), but on sonar report, these two modules can be shown, but their names are same, and it is changed to project key. 


4. if I do't set sonar.projectKey and  sonar.projectName for jenkins sonar plugin, generate sonar report is ok/


Thanks!

Steve

Duarte Meneses

unread,
Feb 2, 2016, 12:02:58 PM2/2/16
to SonarQube, swin...@gmail.com
Hi Steve,

Could you please post the maven command that you are using, and perhaps also the relevant part of the modules' pom files?




Duarte

swin...@gmail.com

unread,
Feb 2, 2016, 8:00:31 PM2/2/16
to SonarQube, swin...@gmail.com
Hi Duarte

my command is: mvn sonar:sonar Dmaven.test.failure.ignore=true -Dsonar.projectKey=stevetest -Dsonar.projectName=stevetest -Dsonar.java.coveragePlugin=jacoco -Dsonar.jacoco.reportMissing.force.zero=true


Steve
Thanks!



在 2016年2月3日星期三 UTC+8上午1:02:58,Duarte Meneses写道:

Duarte Meneses

unread,
Feb 4, 2016, 11:16:41 AM2/4/16
to SonarQube, swin...@gmail.com
Hi Steve,

As discussed in the link you provided, the problem is that in maven modules inherit properties, so in that case the child modules would use the same projectKey and projectName as the parent.

It is better to let the project configuration for the analysis to be taken from the pom files of each module, and have a configuration in the SQ server that is consistent with it.
Reply all
Reply to author
Forward
0 new messages