Jenkins pipeline renames the project in SonarQube

I am trying to establish a static code analysis using SonarQube. Created a project by the name test-project in SonarQube via UI. Ran the sonarscanner within Jenkins pipeline and passed the name of the project as sonar.projectKey

withSonarQubeEnv('sonarserver') { 
                  sh "mvn sonar:sonar -Dsonar.projectKey=test-project"
}

The pipeline ran successfully and the report was published to SonarQube as well but the test-project was renamed to “WebApp Maven Webapp” in the SonarQube UI. I expected it to remain test-project.Any reason why did it happen and how to fix it?

It will use the name specified in the maven pom.xml as you run the sonar maven plugin.

Kind regards,
Michael

Thanks a lot for the solution @reitzmichnicht.