We are having problem with SonarQube - Component key length is longer than the maximum authorized (400). The project is added SonarQube with Android build pipelines. We are using SonarQube 10.2 version.
Additional remarks
Long path names can be made up by any developer. In Android programming, it is typical . On the other hand there is a possibility of reducing the size of the component but it is not piratical always. Something in the sonar side need to find a solution in this case.
We have following error
[2023-11-14T20:15:23.210Z] Warning: A secret was passed to "sh" using Groovy String interpolation, which is insecure.
[2023-11-14T20:15:23.219Z] Affected argument(s) used the following variable(s): [sonarProjectToken]
[2023-11-14T20:15:23.219Z] See https://jenkins.io/redirect/groovy-string-interpolation for details.
[2023-11-14T20:15:23.789Z] + sonar-scanner -Dsonar.token=**** -Dsonar.branch.name=techTask/16.2/run-sonarqube-task
[2023-11-14T20:15:23.789Z] INFO: Scanner configuration file: /opt/sonar-scanner/sonar-scanner-4.8.0.2856/conf/sonar-scanner.properties
[2023-11-14T20:15:23.789Z] INFO: Project root configuration file: /home/ec2-user/data/workspace/Android/Android.Build/sources/sonar-project.properties
[2023-11-14T20:15:23.789Z] INFO: SonarScanner 4.8.0.2856
[2023-11-14T20:15:23.789Z] INFO: Java 17.0.7 Oracle Corporation (64-bit)
[2023-11-14T20:15:23.789Z] INFO: Linux 6.1.55-75.123.amzn2023.x86_64 amd64
[2023-11-14T20:15:23.789Z] INFO: User cache: /home/ec2-user/.sonar/cache
[2023-11-14T20:15:24.249Z] INFO: Analyzing on SonarQube server 10.2.1.78527
[2023-11-14T20:15:24.249Z] INFO: Default locale: "en", source code encoding: "UTF-8"
[2023-11-14T20:15:24.249Z] INFO: Load global settings
[2023-11-14T20:15:24.709Z] INFO: Load global settings (done) | time=162ms
[2023-11-14T20:15:24.709Z] INFO: Server id: SERVER_ID
[2023-11-14T20:15:24.709Z] INFO: User cache: /home/ec2-user/.sonar/cache
[2023-11-14T20:15:24.709Z] INFO: Load/download plugins
[2023-11-14T20:15:24.709Z] INFO: Load plugins index
[2023-11-14T20:15:24.709Z] INFO: Load plugins index (done) | time=45ms
[2023-11-14T20:15:24.709Z] INFO: Load/download plugins (done) | time=235ms
[2023-11-14T20:15:25.159Z] INFO: Loaded core extensions: developer-scanner
[2023-11-14T20:15:25.159Z] INFO: Process project properties
[2023-11-14T20:15:25.159Z] INFO: Process project properties (done) | time=8ms
[2023-11-14T20:15:25.159Z] INFO: Execute project builders
[2023-11-14T20:15:25.159Z] INFO: Execute project builders (done) | time=1ms
[2023-11-14T20:15:25.159Z] INFO: Project key: PROJECT_KEY
[2023-11-14T20:15:25.159Z] INFO: Base dir: /home/ec2-user/data/workspace/Android/Android.Build/sources
[2023-11-14T20:15:25.159Z] INFO: Working dir: /home/ec2-user/data/workspace/Android/Android.Build/sources/.scannerwork
[2023-11-14T20:15:25.159Z] INFO: Load project settings for component key: 'PROJECT_KEY'
[2023-11-14T20:15:25.610Z] INFO: Load project settings for component key: 'PROJECT_KEY' (done) | time=83ms
[2023-11-14T20:15:25.610Z] INFO: Load project branches
[2023-11-14T20:15:25.611Z] INFO: Load project branches (done) | time=31ms
[2023-11-14T20:15:25.611Z] INFO: Load branch configuration
[2023-11-14T20:15:25.611Z] INFO: Found manual configuration of branch/PR analysis. Skipping automatic configuration.
[2023-11-14T20:15:25.611Z] INFO: Load branch configuration (done) | time=2ms
[2023-11-14T20:15:25.611Z] WARN: SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
[2023-11-14T20:15:25.611Z] INFO: Auto-configuring with CI 'Jenkins'
[2023-11-14T20:15:25.611Z] INFO: Load quality profiles
[2023-11-14T20:15:25.611Z] INFO: Load quality profiles (done) | time=98ms
[2023-11-14T20:15:25.611Z] INFO: Load active rules
[2023-11-14T20:15:30.249Z] INFO: Load active rules (done) | time=3919ms
[2023-11-14T20:15:30.249Z] INFO: Load analysis cache
[2023-11-14T20:15:30.249Z] INFO: Load analysis cache | time=430ms
[2023-11-14T20:15:30.249Z] INFO: Branch name: techTask/16.2/run-sonarqube-task
[2023-11-14T20:15:30.249Z] INFO: Load project repositories
[2023-11-14T20:15:30.249Z] INFO: Load project repositories (done) | time=211ms
[2023-11-14T20:15:30.249Z] INFO: Indexing files...
[2023-11-14T20:15:30.249Z] INFO: Project configuration:
[2023-11-14T20:15:30.249Z] INFO: Excluded sources: **/*Test*/**, **/test/**, **/*Debug*/**, **/*Release*/**, **/*Test*/**
[2023-11-14T20:15:30.249Z] INFO: Included tests: **/*Test*/**
[2023-11-14T20:15:40.419Z] INFO: 14610 files indexed... (last one was app/build/tmp/kotlin-classes/LONG_NEST_PATH_TO/RoomMapperTest.class)
[2023-11-14T20:15:44.099Z] INFO: ------------------------------------------------------------------------
[2023-11-14T20:15:44.099Z] INFO: EXECUTION FAILURE
[2023-11-14T20:15:44.099Z] INFO: ------------------------------------------------------------------------
[2023-11-14T20:15:44.099Z] INFO: Total time: 20.560s
[2023-11-14T20:15:44.099Z] INFO: Final Memory: 31M/160M
[2023-11-14T20:15:44.099Z] INFO: ------------------------------------------------------------------------
[2023-11-14T20:15:44.099Z] ERROR: Error during SonarScanner execution
[2023-11-14T20:15:44.099Z] java.lang.IllegalStateException: Component key (PROJECT_KEY:app/build/intermediates/classes/LONG_NEST_PATH_TO/DestinationRepositoryTest$given destinationId is null and ReservationCode is null then call ContentAvailability with selected booking reservation code to get destinationId and then fetch destination from network$1.class) length (427) is longer than the maximum authorized (400)
[2023-11-14T20:15:44.099Z] at org.sonar.api.batch.fs.internal.DefaultIndexedFile.validateKeyLength(DefaultIndexedFile.java:92)
[2023-11-14T20:15:44.100Z] at org.sonar.api.batch.fs.internal.DefaultIndexedFile.<init>(DefaultIndexedFile.java:78)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.FileIndexer.indexFile(FileIndexer.java:147)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer$IndexFileVisitor.visitFile(ProjectFileIndexer.java:274)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer$IndexFileVisitor.visitFile(ProjectFileIndexer.java:246)
[2023-11-14T20:15:44.100Z] at java.base/java.nio.file.Files.walkFileTree(Files.java:2811)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.indexDirectory(ProjectFileIndexer.java:221)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.indexFiles(ProjectFileIndexer.java:207)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.lambda$index$4(ProjectFileIndexer.java:170)
[2023-11-14T20:15:44.100Z] at java.base/java.util.Optional.ifPresent(Optional.java:178)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(ProjectFileIndexer.java:170)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.indexModulesRecursively(ProjectFileIndexer.java:148)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(ProjectFileIndexer.java:118)
[2023-11-14T20:15:44.100Z] at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:358)
[2023-11-14T20:15:44.100Z] at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
[2023-11-14T20:15:44.100Z] at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
[2023-11-14T20:15:44.101Z] at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:139)
[2023-11-14T20:15:44.101Z] at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
[2023-11-14T20:15:44.101Z] at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
[2023-11-14T20:15:44.101Z] at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
[2023-11-14T20:15:44.101Z] at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
[2023-11-14T20:15:44.101Z] at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
[2023-11-14T20:15:44.101Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2023-11-14T20:15:44.101Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[2023-11-14T20:15:44.102Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2023-11-14T20:15:44.102Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2023-11-14T20:15:44.102Z] at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
[2023-11-14T20:15:44.102Z] at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
[2023-11-14T20:15:44.102Z] at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
[2023-11-14T20:15:44.102Z] at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
[2023-11-14T20:15:44.102Z] at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
[2023-11-14T20:15:44.102Z] at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
[2023-11-14T20:15:44.102Z] at org.sonarsource.scanner.cli.Main.main(Main.java:62)
[2023-11-14T20:15:44.102Z] ERROR:
[2023-11-14T20:15:44.102Z] ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
script returned exit code 1