下面是我用于 SonarQube 分析的目录结构。
我正在使用带有 C++ Community 插件版本 0.9.4 的 SonarQube 5.0 和带有 sonar-project.properties 文件中提到的 sonar.sources=../CheckoutDir1 的 sonar-runner 2.4。这就像一个魅力。
然后我升级到 SonarQube 5.1.2,保持 C++ Community 插件、sonar-runner 和 sonar-project.properties 文件完整。现在 sonar-runner 失败并出现以下错误:
14:18:17.531 INFO - Base dir: D:\CheckoutDir2
14:18:17.531 INFO - Working dir: D:\CheckoutDir2\.sonar
14:18:17.531 INFO - Source paths: ../CheckoutDir1
.
.
.
.
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.NullPointerException
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at sun.nio.fs.AbstractPath.resolve(AbstractPath.java:53)
at org.sonar.api.batch.fs.internal.DefaultInputFile.path(DefaultInputFile.java:72)
at org.sonar.api.batch.fs.internal.DefaultInputFile.file(DefaultInputFile.java:64)
at org.sonar.api.batch.fs.internal.PathPattern$RelativePathPattern.match(PathPattern.java:101)
at org.sonar.batch.scan.filesystem.LanguageDetection.isCandidateForLanguage(LanguageDetection.java:124)
at org.sonar.batch.scan.filesystem.LanguageDetection.language(LanguageDetection.java:97)
at org.sonar.batch.scan.filesystem.InputFileBuilder.completeAndComputeMetadata(InputFileBuilder.java:100)
at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:157)
at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:154)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
奇怪的是,sonar-runner 中的调试参数 -X、-e、-Dsonar.verbose=true 没有显示除 java.lang.NullPointerException 之外的其他信息。
如果我提到 sonar.sources 的绝对路径,SonarQube 分析工作正常。
请建议如何解决这个问题?此外,SonarQube 5.1.2 应该清楚地打印有关无法从相对路径定位 sonar.sources 的调试日志。