调试Sonar Qube插件

时间:2015-07-31 07:43:18

标签: sonarqube sonar-runner

按照http://docs.sonarqube.org/display/DEV/Debugging的指南,我遇到了一个问题,声纳转轮似乎在寻找sonar-project.properties文件的错误位置。

当我尝试使用Intellij进行调试时会发生这种情况。

有人可以帮忙吗?

由于 马特

我收到以下错误:

SONAR_RUNNER_OPTS = -Xdebug -Xnoagent -Duser.dir = c:\ dev \ eci -Djava.compiler = NONE -Xrunjdwp:transport = dt_socket,server = y,suspend = y,address = 8000

INFO: Error stacktraces are turned on.

ERROR: homekey=runner.home
ERROR: homrelativePathFromHom=conf/sonar-runner.properties
ERROR: settingsKey=runner.settings
INFO: Runner configuration file: C:\Sonar\sonar-runner-2.4\conf\sonar-        runner.properties
ERROR: homekey=project.home
ERROR: homrelativePathFromHom=sonar-project.properties
ERROR: settingsKey=project.settings
INFO: Project configuration file: NONE
INFO: Default locale: "en_AU", source code encoding: "windows-1252"      (analysis is platform dependent)
INFO: Work directory: c:\dev\eci\.\.sonar
INFO: SonarQube Server 5.1.1
17:30:39.333 INFO  - Load global repositories
17:30:39.340 DEBUG - Download: http://localhost:9000/batch/global (no proxy)
17:30:39.490 INFO  - Load global repositories (done) | time=159ms
17:30:39.492 INFO  - Server id: 20150731104939
17:30:39.493 INFO  - User cache: C:\Users\matthewo\.sonar\cache
17:30:39.499 INFO  - Install plugins
17:30:39.499 DEBUG - Download index of plugins
17:30:39.499 DEBUG - Download: http://localhost:9000/deploy/plugins/index.txt (no proxy)
17:30:39.585 DEBUG - Loaded 2138 properties from l10n bundles
17:30:39.585 INFO  - Install JDBC driver
17:30:39.585 DEBUG - Download index of jdbc-driver
17:30:39.585 DEBUG - Download: http://localhost:9000/deploy/jdbc-driver.txt     (no proxy)
17:30:39.592 INFO  - Create JDBC datasource for     jdbc:jtds:sqlserver://localhost:1433/Sonar;instance=MSSQL2012;SelectMethod=Curso   r
17:31:03.765 DEBUG - Testing JDBC connection
17:31:04.351 DEBUG - Download: http://localhost:9000/api/server (no proxy)
17:31:04.368 INFO  - Initializing Hibernate
17:31:04.370 DEBUG - hibernate.generate_statistics: false
17:31:04.370 DEBUG - hibernate.dialect: org.sonar.core.persistence.dialect.MsSql$MsSqlDialect
17:31:04.370 DEBUG - hibernate.connection.provider_class:   org.sonar.jpa.session.CustomHibernateConnectionProvider
INFO: ----------------------------------------------------------------------  --
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 26.253s
Final Memory: 66M/340M
INFO: ------------------------------------------------------------------------
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.IllegalStateException: You must define the following     mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
         at    org.sonar.batch.scan.ProjectReactorBuilder.checkMandatoryProperties(ProjectReact     orBuilder.java:315)
           at   org.sonar.batch.scan.ProjectReactorBuilder.defineRootProject(ProjectReactorBuild      er.java:157)
    at    org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
    at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:110)
    at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:86)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
    at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 9 more

有没有办法设置工作目录,所以sonar-runner在正确的位置找到项目属性 - 我从哪里执行命令?

由于 马特

1 个答案:

答案 0 :(得分:0)

您为什么要尝试更新用户目录?尝试从-Duser.dir=c:\dev\eci

中删除SONAR_RUNNER_OPTS