Multi maven project names not correct in SonarQube dashboard

  • which versions I am using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube : Version 5.6.3 - Community
    jacoco-maven-plugin : 0.8.3
    sonar-maven-plugin: 3.6.0.1398

  • what are you trying to achieve
    code coverage and code quality analysis of our multi maven java project

  • what have you tried so far to achieve this

    • added and execute the jacoco-maven-plugin and sonar-maven-plugin during our Jenkins nitghtly maven builds.
      installed sonarQube server

All seems to work correctly except for 1 thing:
the maven module names are not correctly displayed in the sonarqube top level dashboard projects widget when I drill down from the project to the module level:

module level for project vp-parent_6.2:

The problem: all Maven modules get the the same name as the parent project.
This is how we call sonar from Jenkins build config:

Maven 3.3.9 task with these goals : sonar:sonar-Dsonar.projectName=vp-parent_6.2-Dsonar.projectKey=vp-parent_6.2-Dsonar.cpd.exclusions=**/*

This is the maven config for sonar and jacoco:


       <!--  jacoco plugin for  determining the unit test code coverage -->
       <!-- Testing: Visualize code coverage for tests -->
       <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
           <version>0.8.3</version>
           <configuration>
               <destFile>${sonar.jacoco.reportPath}</destFile>
               <append>true</append>
           </configuration>
           <executions>
               <execution>
                   <id>agent</id>
                   <goals>
                       <goal>prepare-agent</goal>
                   </goals>
               </execution>
           </executions>
       </plugin>


       <!--  sonar plugin for enabling  code coverage analysis -->
       <plugin>
           <groupId>org.sonarsource.scanner.maven</groupId>
           <artifactId>sonar-maven-plugin</artifactId>
           <version>3.6.0.1398</version>
           <dependencies>
               <dependency>
                   <groupId>net.sourceforge.pmd</groupId>
                   <artifactId>pmd-java</artifactId>
                   <!-- support java 8 -->
                   <version>5.5.3</version>
               </dependency>
           </dependencies>
       </plugin>

         </plugins>
            <pluginManagement>
                <plugins>







org.jacoco
jacoco-maven-plugin
0.8.3

${sonar.jacoco.reportPath}
true



agent

prepare-agent



                        <!--  sonar plugin for enabling  code coverage analysis -->
                        <plugin>
                            <groupId>org.sonarsource.scanner.maven</groupId>
                            <artifactId>sonar-maven-plugin</artifactId>
                            <version>3.6.0.1398</version>
                            <dependencies>
                                <dependency>
                                    <groupId>net.sourceforge.pmd</groupId>
                                    <artifactId>pmd-java</artifactId>
                                    <!-- support java 8 -->
                                    <version>5.5.3</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                </plugins>
            </pluginManagement>


What do I need to change to get Sonarqube report the module names properly???

Regards,
Jan van de klok

Hello!

First of all – you are 2 LTS version of SonarQube behind. You probably won’t find a lot of help for such an old version of SonarQube. You should start planning your upgrade!

More generally (and this applies to all versions of SonarQube that still use modules) – I’m guessing that by setting the name at the command line, precedence of analysis parameters kicks in and overrides the project name for every module.

Is there a specific reason you’re trying to override the Project Name at the root level, or could you let Maven just do it’s thing and name everything based on the information available in your pom.xml files?

The reason for overriding the name is the we have 3 versions of vp-parent (6.0, 6.1 and 6.2) and we build and analyze the all 3 every night.

When we dont’override the projectname ther will only 1 project vp-parent in sonarqube which contains the last analysis of whichever version of vp-parent was last build.

I did not know how to fix that so i decided to override the project name for each version.
Maybe you can give me a hint how to get the 3 versions of the project in sonarqube without overriding the project names.

Jan