Component key not found

  • which versions are you using
    SonarQube Version 6.7.7

  • what are you trying to achieve
    We are trying to merge some code with a Pull Request

mvn sonar:sonar -DskipTests -Dsonar.host.url=https://server -Dsonar.login=****** -Dsonar.projectKey=key -Dsonar.branch.name=PR-35 -Dsonar.branch.target=develop -Dsonar.analysis.mode=preview -Dsonar.github.endpoint=https://url/api/v3 -Dsonar.github.oauth=validoauth-Dsonar.github.pullRequest=35 -Dsonar.github.repository=repo

  • what have you tried so far to achieve this

The analysis on feature branch and development branch run correctly
On the PR I got following problem:
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.1.1688:sonar
{“msg”:“Component key ‘***/responseevent/ResponseEventDTO.java’ not found”}

Additional information: in preview source code the package name was “responseEvent”, we rename this packages with “responseevent”

How can I solve this problem?
Thanks in advance

Hi,

Welcome to the community!

There’s actually a lot going on here. You’ve provided your analysis command (yay!) and some things in it jump out at me:

mvn sonar:sonar -DskipTests -Dsonar.host.url=https:// *server*  -Dsonar.login=****** -Dsonar.branch.name=PR-35 -Dsonar.branch.target=develop

This part is all normal and expected.

  • -Dsonar.projectKey= *key* - Theoretically this should be read from your Maven project’s pom file, so no need to also provide it here.
  • -Dsonar.analysis.mode=preview - This parameter says "don’t send any results to the server. It’s probably not what you meant to do. Additionally, this parameter is deprecated in 6.7 IIRC and removed by 7.9.
  • -Dsonar.github.endpoint=https:// *url* /api/v3 - This is only useful / valid when set server-side. This value is used for PR decoration (which won’t happen because your preview parameter prevented anything from being sent to the server). Analysis parameter values are out of scope by the time decoration is performed, so this value isn’t available when it would be needed.
  • -Dsonar.github.oauth= *validoauth* - Wha? Why?
  • -Dsonar.github.pullRequest=35 - I don’t recognize this parameter
  • -Dsonar.github.repository= *repo* - See what I said above about the endpoint parameter.

Now, most of those^ things shouldn’t have anything to do with the analysis error you’re reporting. It’s possible that the Preview mode is having trouble with the renaming. It’s also true, IIRC, that we improved file move/rename handling in the 7.x series, and it’s true that 6.7.7 is quite old now and only a few short days from being E.O.L. The current version is 8.0 and the current LTS is 7.9.1.

You should upgrade SonarQube at your earliest convenience, clean up your analysis command, and let us know if your problems persist after that.

 
HTH,
Ann

A post was split to a new topic: GH Check eternally queued