Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-14210

Add support for scanning a projects from a symlinked work directory

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Scanner
    • Labels:
      None
    • Edition:
      Community

      Description

      Scanning a project from working directory that is a symlink to the actual project base directory will results in java.lang.IllegalArgumentException: 'other' has different root errors

      We use a symlink from C:\User\jenkins-data -> D:\app\BuildServer\jenkins-data which leads to a failure when running the command mvn sonar:sonar from the symlink location, e.g. C:\User\jenkins-data\workspace\Application-Updater-Nightly.
      Running the same from the resolved path D:\app\BuildServer\jenkins-data\workspace\Application-Updater-Nightly works but defeats the purpose of the symlink…

      [INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) @ updater ---
      [INFO] User cache: C:\Users\xyz\.sonar\cache
      [INFO] SonarQube version: 7.9.4
      [INFO] Default locale: "en", source code encoding: "UTF-8"
      [WARNING] SonarScanner will require Java 11 to run starting in SonarQube 8.x
      [INFO] Load global settings
      [INFO] Load global settings (done) | time=140ms
      [INFO] Server id: 243B8A4D-AW0lqZP-G1ENnso8eDab
      [INFO] User cache: C:\Users\xyz\.sonar\cache
      [INFO] Load/download plugins
      [INFO] Load plugins index
      [INFO] Load plugins index (done) | time=47ms
      [INFO] Load/download plugins (done) | time=78ms
      [INFO] Process project properties
      [INFO] Execute project builders
      [INFO] Execute project builders (done) | time=15ms
      [INFO] Project key: com.company.application:updater
      [INFO] Base dir: C:\User\jenkins-data\workspace\Application-Updater-Nightly
      [INFO] Working dir: C:\User\jenkins-data\workspace\Application-Updater-Nightly\target\sonar
      [INFO] Load project settings for component key: 'com.company.application:updater'
      [INFO] Load quality profiles
      [INFO] Load quality profiles (done) | time=47ms
      [INFO] Detected Jenkins
      [INFO] Load active rules
      [INFO] Load active rules (done) | time=672ms
      [INFO] Indexing files...
      [INFO] Project configuration:
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  02:03 min
      [INFO] Finished at: 2020-11-09T02:17:19+01:00
      [INFO] ------------------------------------------------------------------------
      [INFO] [jenkins-event-spy] Generated C:\User\jenkins-data\workspace\Application-Updater-Nightly@tmp\withMaven43a88c7c\maven-spy-20201109-021515-7417881443634940600399.log
      [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project updater: 'other' has different root -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project updater: 'other' has different root
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      Caused by: org.apache.maven.plugin.MojoExecutionException: 'other' has different root
          at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:67)
          at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:104)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      Caused by: java.lang.IllegalArgumentException: 'other' has different root
          at sun.nio.fs.WindowsPath.relativize (WindowsPath.java:392)
          at sun.nio.fs.WindowsPath.relativize (WindowsPath.java:44)
          at org.sonarsource.scm.git.IncludedFilesRepository.indexFiles (IncludedFilesRepository.java:55)
          at org.sonarsource.scm.git.IncludedFilesRepository.<init> (IncludedFilesRepository.java:40)
          at org.sonarsource.scm.git.GitIgnoreCommand.init (GitIgnoreCommand.java:37)
          at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index (ProjectFileIndexer.java:104)
          at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart (ProjectScanContainer.java:353)
          at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136)
          at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122)
          at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart (GlobalContainer.java:141)
          at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136)
          at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122)
          at org.sonar.batch.bootstrapper.Batch.doExecute (Batch.java:73)
          at org.sonar.batch.bootstrapper.Batch.execute (Batch.java:67)
          at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute (BatchIsolatedLauncher.java:46)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke (IsolatedLauncherProxy.java:60)
          at com.sun.proxy.$Proxy25.execute (Unknown Source)
          at org.sonarsource.scanner.api.EmbeddedScanner.doExecute (EmbeddedScanner.java:189)
          at org.sonarsource.scanner.api.EmbeddedScanner.execute (EmbeddedScanner.java:138)
          at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute (ScannerBootstrapper.java:65)
          at org.sonarsource.scanner.maven.SonarQubeMojo.execute (SonarQubeMojo.java:104)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mark.rekveld Mark Rekveld (Inactive)
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: