Component key length is longer than the maximum authorized (400)

  • versions used SonarQube 6.7
  • error observed: Component key length (401) is longer than the maximum authorized (400)
  • steps to reproduce: run run sonar on long project key on long sub module with long full qualify file name - all together should exceed 400 chars.
  • potential workaround - manipulate sonar.projectKey - but it won’t prevent from a developer in the future to add file that will eventually will exceed the allowed component key length - and hence analysy and will fail.

update 01

  • when maven building default projectKey - the analysis task in sonarqube complete successful.
    in this case the component key is built this way: sub-module + full qualify file name.

  • when sonar.projectKey explicitly populated (even with the same default key maven would generate): the component key is built this way: sonar.projectKey + sub-module (groupId:artifactId) + full qualify file name.

update 02

  • when the same project run on SonarQube 7.9.2 component key generated differently (and much shorter)-
    sonar.projectKey + sub-module (artifactId) + full qualify file name.

please fix this bug or advise how to overcome it

Hi,

You’ve already observed that the problem is fixed in the current LTS, 7.9.3. So to overcome it, you’ll just upgrade to a supported version; 6.7 is past EOL.

 
Ann

Hello,

We are running a quite recent build - Version 8.6 (build 39681) and experience the same issue.

The project name we use is quite short, but some projects have a very nested directory structure causing a the full path name to exceed the 400 character limit (when combined with the project name and a colon).

We are using a naming convention for the project name, to keep it unique and allow reporting issues in separate branches. I was thinking of hashing that string to use as a project name, but it will still not overcome the issue of the pathname concatenation, for which I have no control (any developer can create arbitrary long path names).

What do you suggest would be a possible workaround for this?

As this issue is reportedly fixed, I’ve opened a new one: Deeply nested folder structure fail on component key validation due to 400 character limit