2

我有戏!我正在编译和运行 JaCoCo 的 web 插件项目。在此之后,我想使用 Sonar runner 运行声纳分析。我们有一个 SonarQube 4.0 服务器启动并运行,我已经安装了 Sonar Runner 2.3。我正在使用本地 Bamboo 远程代理在 VM 上运行所有与构建相关的任务。

在运行“sonar-runner -X -e”结束时出现以下错误

14:05:14.998 INFO  - Analysing <path-to>/jacoco.exec
06-Dec-2013 17:05:15    14:05:15.008 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@5ca267af[id=52670,key=work.stuff:Web-Plugin,qualifier=TRK], with key batch-work.stuff:Web-Plugin
06-Dec-2013 17:05:15    14:05:15.401 DEBUG - To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered
06-Dec-2013 17:05:15    INFO: ------------------------------------------------------------------------
06-Dec-2013 17:05:15    INFO: EXECUTION FAILURE
06-Dec-2013 17:05:15    INFO: ------------------------------------------------------------------------
06-Dec-2013 17:05:15    Total time: 6:31.254s
06-Dec-2013 17:05:15    ERROR: Error during Sonar runner execution
06-Dec-2013 17:05:15    org.sonar.runner.impl.RunnerException: Unable to execute Sonar
06-Dec-2013 17:05:15            at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
06-Dec-2013 17:05:15            at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
06-Dec-2013 17:05:15            at java.security.AccessController.doPrivileged(Native Method)
06-Dec-2013 17:05:15            at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
06-Dec-2013 17:05:15            at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
06-Dec-2013 17:05:15            at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
06-Dec-2013 17:05:15            at org.sonar.runner.api.Runner.execute(Runner.java:90)
06-Dec-2013 17:05:15            at org.sonar.runner.Main.executeTask(Main.java:70)
06-Dec-2013 17:05:15            at org.sonar.runner.Main.execute(Main.java:59)
06-Dec-2013 17:05:15            at org.sonar.runner.Main.main(Main.java:41)
06-Dec-2013 17:05:15    Caused by: java.lang.NullPointerException
06-Dec-2013 17:05:15            at org.sonar.plugins.jacoco.ExecutionDataVisitor.visitClassExecution(ExecutionDataVisitor.java:48)
06-Dec-2013 17:05:15            at org.jacoco.core.data.ExecutionDataReader.readExecutionData(ExecutionDataReader.java:149)
06-Dec-2013 17:05:15            at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:113)
06-Dec-2013 17:05:15            at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:87)
06-Dec-2013 17:05:15            at org.sonar.plugins.jacoco.AbstractAnalyzer.readExecutionData(AbstractAnalyzer.java:133)
06-Dec-2013 17:05:15            at org.sonar.plugins.jacoco.AbstractAnalyzer.analyse(AbstractAnalyzer.java:106)
06-Dec-2013 17:05:15            at org.sonar.plugins.jacoco.JaCoCoSensor.analyse(JaCoCoSensor.java:54)
06-Dec-2013 17:05:15            at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72)
06-Dec-2013 17:05:15            at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
06-Dec-2013 17:05:15            at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150)
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
06-Dec-2013 17:05:15            at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:190)
06-Dec-2013 17:05:15            at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:185)
06-Dec-2013 17:05:15            at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:178)
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
06-Dec-2013 17:05:15    Final Memory: 27M/664M
06-Dec-2013 17:05:15    INFO: ------------------------------------------------------------------------
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
06-Dec-2013 17:05:15            at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:58)
06-Dec-2013 17:05:15            at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
06-Dec-2013 17:05:15            at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
06-Dec-2013 17:05:15            at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:155)
06-Dec-2013 17:05:15            at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:143)
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
06-Dec-2013 17:05:15            at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
06-Dec-2013 17:05:15            at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
06-Dec-2013 17:05:15            at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
06-Dec-2013 17:05:15            at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
06-Dec-2013 17:05:15            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
06-Dec-2013 17:05:15            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
06-Dec-2013 17:05:15            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
06-Dec-2013 17:05:15            at java.lang.reflect.Method.invoke(Method.java:601)
06-Dec-2013 17:05:15            at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
06-Dec-2013 17:05:15            ... 9 more
06-Dec-2013 17:05:16    Failing task since return code of [<bamboo-stuff>-ScriptBuildTask-4543364793727960070.sh] was 1 while expected 0

我的 sonar-project.properties 文件如下所示:它位于我的项目树的头部,并且我使用的所有路径都经过验证。

# Required metadata
sonar.projectKey=<work.stuff>:Web-Plugin
sonar.projectName=Web-Plugin
sonar.projectVersion=0.0.1-SNAPSHOT

# Paths to source directories.
# Paths are relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Do not put the "sonar-project.properties" file in the same directory with the source code.
# (i.e. never set the "sonar.sources" property to ".")
sonar.sources=app

# The value of the property must be the key of the language.
sonar.language=java

#----- JaCoCo Stuff
sonar.jacoco.reportPath=target/scala-2.10/jacoco/jacoco.exec
#----- JUnit test Stuff
sonar.junit.reportsPath=target/test-reports/

#----- Binaries and libraries information
sonar.binaries=target/scala-2.10/classes
sonar.libraries=<tons of relative paths to relevant .jars>

无论有没有 sonar.libraries 声明,我都收到了这个错误。

4

1 回答 1

0

因为我的声誉 < 50 我只能发布答案而不能发表评论...

在那之前你有没有用你的声纳跑步者做过什么?如果没有,您应该检查您的 sonar-runner.properties 并填写所需的内容。例如,在我的公司,我们填写了以下内容(使用 oracle databand 或 jbdc):

sonar.host.url, sonar.jbdc.url, sonar.jdbc.username, sonar.jdbc.password, sonar.jdbc.driver, sonar.login, sonar.password, sonar.sourceEncoding, ...

于 2014-04-03T11:22:45.010 回答