使用Ant在TeamCity构建上运行的SonarQube分析失败,并且" org.sonar.runner.impl.RunnerException:无法执行Sonar"。来自TeamCity服务器的构建日志的摘录是:
[11:46:01]E: [Step 1/1] sonar (13s)
[11:46:01]E: [sonar] sonar:sonar (13s)
[11:46:01] : [sonar:sonar] Apache Ant(TM) version 1.8.2 compiled on December 20 2010
[11:46:01] : [sonar:sonar] SonarQube Ant Task version: 2.3
[11:46:01] : [sonar:sonar] Loaded from: file:/D:/project/tcity/agentWork/tcagentW3_Windows/work/f0604fb8834cecda/lib/dev/sonar-ant-task-2.3.jar
[11:46:01] : [sonar:sonar] INFO: Default locale: "en_US", source code encoding: "UTF-8"
[11:46:01] : [sonar:sonar] INFO: Work directory: D:\project\tcity\agentWork\tcagentW3_Windows\work\f0604fb8834cecda\.sonar
[11:46:01] : [sonar:sonar] INFO: SonarQube Server 4.5.4
[11:46:03] : [sonar:sonar] 11:46:03.025 INFO - Load global referentials...
[11:46:04] : [sonar:sonar] 11:46:04.312 INFO - Load global referentials done: 1291 ms
[11:46:04] : [sonar:sonar] 11:46:04.328 INFO - User cache: C:\Users\tcagentW3_Windows\.sonar\cache
[11:46:04] : [sonar:sonar] 11:46:04.353 INFO - Install plugins
[11:46:04] : [sonar:sonar] 11:46:04.672 INFO - Download sonar-css-plugin-1.2.jar
[11:46:04] : [sonar:sonar] 11:46:04.867 INFO - Download sonar-pmd-plugin-2.4.1.jar
[11:46:05] : [sonar:sonar] 11:46:05.053 INFO - Download sonar-android-plugin-1.1.jar
[11:46:05] : [sonar:sonar] 11:46:05.446 INFO - Download sonar-jmeter-plugin-0.3.jar
[11:46:05] : [sonar:sonar] 11:46:05.773 INFO - Download sonar-csharp-plugin-4.0.jar
[11:46:05] : [sonar:sonar] 11:46:05.871 INFO - Download sonar-java-plugin-3.3.jar
[11:46:06] : [sonar:sonar] 11:46:06.149 INFO - Download sonar-checkstyle-plugin-2.3.jar
[11:46:06] : [sonar:sonar] 11:46:06.334 INFO - Download sonar-python-plugin-1.5.jar
[11:46:06] : [sonar:sonar] 11:46:06.449 INFO - Download sonar-javascript-plugin-2.6.jar
[11:46:06] : [sonar:sonar] 11:46:06.542 INFO - Download sonar-build-stability-plugin-1.3.jar
[11:46:06] : [sonar:sonar] 11:46:06.580 INFO - Download sonar-findbugs-plugin-3.2.jar
[11:46:06] : [sonar:sonar] 11:46:06.780 INFO - Download sonar-groovy-plugin-1.1.1.jar
[11:46:07] : [sonar:sonar] 11:46:07.093 INFO - Download sonar-php-plugin-2.5.jar
[11:46:09] : [sonar:sonar] 11:46:09.098 INFO - Install JDBC driver
[11:46:09] : [sonar:sonar] 11:46:09.109 INFO - Create JDBC datasource for jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sonar-so-1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=sonar-so-2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=SONARD)))
[11:46:11] : [sonar:sonar] 11:46:11.669 INFO - Initializing Hibernate
[11:46:15] : [sonar:sonar] 11:46:15.505 INFO - Load project referentials...
[11:46:15] : [sonar:sonar] 11:46:15.522 INFO - Load project referentials done: 17 ms
[11:46:15]E: [sonar:sonar] org.sonar.runner.impl.RunnerException: Unable to execute Sonar
[11:46:15]W: [Step 1/1] Process exited with code 1
[11:46:15]W: [Step 1/1] Ant output
[11:46:15]W: [Ant output] at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
[11:46:15]W: [Ant output] at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
[11:46:15]W: [Ant output] at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
[11:46:15]W: [Ant output] at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
[11:46:15]W: [Ant output] at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
[11:46:15]W: [Ant output] at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
[11:46:15]W: [Ant output] at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698)
[11:46:15]W: [Ant output] at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
[11:46:15]W: [Ant output] at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:677)
[11:46:15]W: [Ant output] at org.sonar.api.platform.ComponentContainer.getComponentByType(ComponentContainer.java:209)
[11:46:15]W: [Ant output] at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:102)
[11:46:15]W: [Ant output] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
[11:46:15]W: [Ant output] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
[11:46:15]W: [Ant output] at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
[11:46:15]W: [Ant output] at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
[11:46:15]W: [Ant output] at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
[11:46:15]W: [Ant output] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
[11:46:15]W: [Ant output] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
[11:46:15]W: [Ant output] at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
[11:46:15]W: [Ant output] at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
[11:46:15]W: [Ant output] at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
[11:46:15]W: [Ant output] at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
[11:46:15]W: [Ant output] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[11:46:15]W: [Ant output] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[11:46:15]W: [Ant output] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[11:46:15]W: [Ant output] at java.lang.reflect.Method.invoke(Method.java:606)
[11:46:15]W: [Ant output] at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
[11:46:15]W: [Ant output] ... 24 more
[11:46:15]W: [Ant output]
[11:46:15]W: [Ant output] Total time: 21 minutes 42 seconds
[11:46:16]i: [Step 1/1] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_Ant_244' value='1303420.0']
[11:46:16]E: [Step 1/1] Step Ant failed
消息"无法执行声纳"对我来说并不是很解释。问题在哪里?
答案 0 :(得分:0)
我也遇到了同样的问题。请检查sonar-ant-task - * .jar版本与Sonarqube的兼容性。我已经将jar更新为sonar-ant-task-2.2,它对我有用。