Sonar-Runner的工作不能写入G:\。sonar_lock(看起来像缓存目录给我)

时间:2016-01-04 22:14:00

标签: sonar-runner

我们使用Sonar-Runner 2.4和MSSqlServer安装了一个新的SonarQube 5.2实例和sonar.jdbc.url = jdbc:jtds:sqlserver:... driver。

由于某种原因,我们无法通过sonar-runner.bat分析来识别.sonar_lock配置的写入位置。某处似乎存在权限错误,这可能是因为任务是在" bamboo"服务帐户用户。这也可能是由于某个地方(可能)从其他服务器复制的缓存数据。不确定。我可以看到锁应该存在的位置,我们正试图设置     -Dsonar.working.directory = $ {bamboo.build.working.directory} /。声纳和     -Dsonar_user_home = $ {bamboo.build.working.directory} /../。sonar(尝试在运行时将其写入公共目录,但是在尝试写入" G:\时仍出现错误"我们不希望它写入驱动器的根目录,因为相对于该位置的安全策略存在糟糕的juju。我们无论如何都看不到它的位置。

Maven插件工作正常,groovy插件工作正常,这只是使用sonar-runner.bat的一个问题。我检查了.bat文件并做了一个硬编码"设置SONAR_RUNNER_HOME =%~dp0 .."到一个不是G:驱动器的位置。但这仍然是在同一位置给我们错误。

我们看到的错误是:

build   04-Jan-2016 15:07:11    15:07:11.297 DEBUG - Publish global mode
build   04-Jan-2016 15:07:11    15:07:11.843 DEBUG - cache:         C:\Users\XBBOSP000\.sonar\ws_cache\https%3A%2F%2Fsomewebsitesomewhere.net\global
build   04-Jan-2016 15:07:11    15:07:11.906 INFO  - Load global repositories
build   04-Jan-2016 15:07:11    15:07:11.937 DEBUG - Download: https://somewebsitesomewhere.net/batch/global (no proxy)
build   04-Jan-2016 15:07:12    15:07:12.514 INFO  - Load global repositories (done) | time=592ms
build   04-Jan-2016 15:07:12    15:07:12.842 WARN  - Property 'sonar.jdbc.url' is not supported any more. There is no more DB connection to the SQ database. It will be ignored.
build   04-Jan-2016 15:07:12    15:07:12.873 INFO  - User cache: C:\Users\XBBOSP000\.sonar\cache
build   04-Jan-2016 15:07:14    15:07:14.152 INFO  - Load plugins index
build   04-Jan-2016 15:07:14    15:07:14.152 DEBUG - Download: https://somewebsitesomewhere.net/deploy/plugins/index.txt (no proxy)
build   04-Jan-2016 15:07:14    15:07:14.214 INFO  - Load plugins index (done) | time=62ms
build   04-Jan-2016 15:07:14    15:07:14.214 DEBUG - Load plugins
build   04-Jan-2016 15:07:15    15:07:15.806 DEBUG - Load plugins (done) | time=1592ms
build   04-Jan-2016 15:07:15    15:07:15.962 DEBUG - API compatibility mode is enabled on plugin JavaScript [javascript] (built with API lower than 5.2)
build   04-Jan-2016 15:07:15    15:07:15.962 DEBUG - API compatibility mode is enabled on plugin Findbugs [findbugs] (built with API lower than 5.2)
build   04-Jan-2016 15:07:15    15:07:15.977 DEBUG - API compatibility mode is enabled on plugin Groovy [groovy] (built with API lower than 5.2)
build   04-Jan-2016 15:07:15    15:07:15.993 DEBUG - API compatibility mode is enabled on plugin Web [web] (built with API lower than 5.2)
build   04-Jan-2016 15:07:15    15:07:15.993 DEBUG - API compatibility mode is enabled on plugin XML [xml] (built with API lower than 5.2)
build   04-Jan-2016 15:07:15    15:07:15.993 DEBUG - API compatibility mode is enabled on plugin Widget Lab [widgetlab] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.024 DEBUG - API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.024 DEBUG - API compatibility mode is enabled on plugin JIRA [jira] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.024 DEBUG - API compatibility mode is enabled on plugin Page Decoration [pagedecoration] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.040 DEBUG - API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.055 DEBUG - API compatibility mode is enabled on plugin PMD [pmd] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.071 DEBUG - API compatibility mode is enabled on plugin Java [java] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.071 DEBUG - API compatibility mode is enabled on plugin .NET [dotnet] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.086 DEBUG - API compatibility mode is enabled on plugin C# [csharp] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.118 DEBUG - API compatibility mode is enabled on plugin Crowd [crowd] (built with API lower than 5.2)
build   04-Jan-2016 15:07:16    15:07:16.118 DEBUG - API compatibility mode is enabled on plugin Cobertura [cobertura] (built with API lower than 5.2)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG - Plugins:
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * JavaScript 2.8 (javascript)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Findbugs 3.3 (findbugs)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Groovy 1.3 (groovy)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Web 2.4 (web)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * XML 1.3 (xml)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Widget Lab 1.8.1 (widgetlab)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Git 1.0 (scmgit)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * JIRA 1.2 (jira)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Page Decoration 1.0.1 (pagedecoration)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * SVN 1.2 (scmsvn)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * PMD 2.5 (pmd)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Java 3.7.1 (java)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * .NET 2.1 (dotnet)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * C# 4.3 (csharp)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Crowd 2.0 (crowd)
build   04-Jan-2016 15:07:18    15:07:18.785 DEBUG -   * Cobertura 1.6.3 (cobertura)
build   04-Jan-2016 15:07:19    15:07:19.659 INFO  - Process project properties
build   04-Jan-2016 15:07:19    15:07:19.659 DEBUG - Process project properties (done) | time=0ms
build   04-Jan-2016 15:07:20    INFO: ------------------------------------------------------------------------
build   04-Jan-2016 15:07:20    INFO: EXECUTION FAILURE
build   04-Jan-2016 15:07:20    INFO: ------------------------------------------------------------------------
build   04-Jan-2016 15:07:20    Total time: 14.639s
build   04-Jan-2016 15:07:20    Final Memory: 8M/76M
build   04-Jan-2016 15:07:20    INFO: ------------------------------------------------------------------------
error   04-Jan-2016 15:07:20    ERROR: Error during Sonar runner execution
error   04-Jan-2016 15:07:20    org.sonar.runner.impl.RunnerException: Unable to execute Sonar
error   04-Jan-2016 15:07:20        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
error   04-Jan-2016 15:07:20        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
error   04-Jan-2016 15:07:20        at java.security.AccessController.doPrivileged(Native Method)
error   04-Jan-2016 15:07:20        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
error   04-Jan-2016 15:07:20        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
error   04-Jan-2016 15:07:20        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
error   04-Jan-2016 15:07:20        at org.sonar.runner.api.Runner.execute(Runner.java:100)
error   04-Jan-2016 15:07:20        at org.sonar.runner.Main.executeTask(Main.java:70)
error   04-Jan-2016 15:07:20        at org.sonar.runner.Main.execute(Main.java:59)
error   04-Jan-2016 15:07:20        at org.sonar.runner.Main.main(Main.java:53)
error   04-Jan-2016 15:07:20    Caused by: java.lang.IllegalStateException: Failed to create lock in G:\.sonar_lock
error   04-Jan-2016 15:07:20        at org.sonar.home.cache.DirectoryLock.tryLock(DirectoryLock.java:67)
error   04-Jan-2016 15:07:20        at org.sonar.batch.scan.ProjectLock.tryLock(ProjectLock.java:43)
error   04-Jan-2016 15:07:20        at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:118)
error   04-Jan-2016 15:07:20        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:98)
error   04-Jan-2016 15:07:20        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
error   04-Jan-2016 15:07:20        at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
error   04-Jan-2016 15:07:20        at     org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
error   04-Jan-2016 15:07:20        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:76)
error   04-Jan-2016 15:07:20        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
error   04-Jan-2016 15:07:20        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error   04-Jan-2016 15:07:20        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
error   04-Jan-2016 15:07:20        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error   04-Jan-2016 15:07:20        at java.lang.reflect.Method.invoke(Method.java:606)
error   04-Jan-2016 15:07:20        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
error   04-Jan-2016 15:07:20        ... 9 more
error   04-Jan-2016 15:07:20    Caused by: java.io.FileNotFoundException: G:\.sonar_lock (Access is denied)
error   04-Jan-2016 15:07:20        at java.io.RandomAccessFile.open(Native Method)
error   04-Jan-2016 15:07:20        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:241)
error   04-Jan-2016 15:07:20        at org.sonar.home.cache.DirectoryLock.tryLock(DirectoryLock.java:61)
error   04-Jan-2016 15:07:20        ... 22 more

2 个答案:

答案 0 :(得分:0)

查看您的声纳扫描项目目录并删除那里的所有 .scannerwork 文件。在我的情况下,我以 root 身份在 Jenkins 之外运行了一个测试配置,并且在这些测试运行中创建的 .scannerwork 文件与来自 Jenkins 的声纳扫描相冲突。我刚刚删除了该文件,Jenkins 能够毫无问题地创建一个新文件。

答案 1 :(得分:-1)

我不确定这是怎么回事,但似乎是项目的某种配置问题。我终于对项目的配置做了一些清理工作,最后让它在最后一个给我错误的项目上工作。