java.lang.IllegalArgumentException on SonarScanner.MSBuild end

  • Developer Edition Version 7.9.1 (build 27448)
  • SonarScanner for MSBuild 4.7.1
  • Microsoft ® Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
  • openjdk 13.0.1 2019-10-15
  • Microsoft Windows [Version 10.0.18362.418] (x64)

I am new to sonarqube. I have setup my first project and am successfully running sonarscanner on my personal dev system. I am trying to add sonarscanner to by build pipeline in GitLab. At this point I am logged in directly the runner machine in order to debug so GitLab is out of the way. I am getting the following from SonarScanner.MSBuild.exe end

17:17:44.816 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: 'other' has different root
        at java.base/sun.nio.fs.WindowsPath.relativize(
        at java.base/sun.nio.fs.WindowsPath.relativize(
        at org.sonarsource.scm.git.IncludedFilesRepository.indexFiles(
        at org.sonarsource.scm.git.IncludedFilesRepository.<init>(
        at org.sonarsource.scm.git.GitIgnoreCommand.init(
        at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(
        at org.sonar.core.platform.ComponentContainer.startComponents(
        at org.sonar.core.platform.ComponentContainer.execute(
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(
        at org.sonar.core.platform.ComponentContainer.startComponents(
        at org.sonar.core.platform.ComponentContainer.execute(
        at org.sonar.batch.bootstrapper.Batch.doExecute(
        at org.sonar.batch.bootstrapper.Batch.execute(
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.base/java.lang.reflect.Method.invoke(
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.main(

I believe this error has to do with absolute vs relative paths. I added /d:sonar.verbose=true and all paths printed are absolute. I don’t know what to do next. Any suggestions?

I tried to paste my command prompt output but it was too big. Let me know what, if any part of the output is helpful and I’ll add it.

In case it’s helpful to anyone, I believe I have solved this.

My build systems use a ram drive on r: which is symlinked to c:\gitlab-runner\builds. All the logs correctly showed the c:… paths and the sonar scan was even working on some systems, but not others. After digging I found that failing systems had worktree = r:/… in .git\config. I’m sure why that is there only some systems but I believe it has to do with the version of gitlab-runner.exe. Anyhow, I reconfigured all build systems to use r:\ directly (no more symlink) and the problem has gone away.