0

I have this error on SonarQube 6.1

Please note: I cannot shorten the projecy key, since I have no power over the organization's naming convention, our work is to mantain the platform. I am aware the name can be made short, but I am looking for a workaround (ie. ALTER table for the field lenght? If so, which and how?)

"java.lang.IllegalArgumentException: Component key length is longer (401) than the maximum authorized (400)"

The kee is indeed longer than the 400 characters allowed, but I have no control over the naming convention since we manage the build system.

That said, I am looking for a workaround to overcome this error. Any guesses ?

Giovani S.
  • 71
  • 1
  • 12

1 Answers1

2

I suggest to shorten the project key:

  • SonarQube documentation to rename a key in SonarQube
  • launch analyses with the sonar.projectKey property, with the new shorten key
  • Hi @teryk, what if I cannot shorten the project name? Any ALTER table would work? – Giovani S. Dec 18 '16 at 17:14
  • I'm not sure I understand. Do you have admin rights on SonarQube? Are in charge of the build team? Then you can change the project key only in SonarQube. I must be missing something I do not advise to change the DB directly. Next analysis, SonarQube will not recognize the project as the same one. – Teryk - SonarSource Dec 20 '16 at 08:30
  • I am a sonar admin. I am not in charge of the build team. They have maven with the sonar-maven-plugin which calls our sonarqube instance using IBM Rational Build Forge and passes the project key name as an analysis parameter, so I have no power over its long name. We are part of an Audit office. If I change the project key in sonar, what happens when they call the next analysis passing the same long name again? – Giovani S. Dec 21 '16 at 19:22
  • it will create a new project. Sonar relies on the project key to detect if the project already exists. 400 characters is a very long key. Ask them to change the project key when calling the sonarqube instance and overriding the maven key with `sonar.projectKey` parameter. Don't forget to first rename in SonarQube to not loose the history of the project – Teryk - SonarSource Dec 22 '16 at 09:25
  • Sorry, I can't change the naming convention. Can I issue any "ALTER table" to try to fix this? – Giovani S. Dec 26 '16 at 19:53
  • nope, as I said the next analysis won't recognize the project as the key will be different. My solution doesn't need to change the project code. I cannot do better than that, sorry – Teryk - SonarSource Dec 27 '16 at 08:08
  • I see a similar issue in SonarCloud related to "component key" which seems to be the path to the class must be less than 400 characters. Feels like a Windows problem – jediwompa Feb 24 '23 at 20:56