Sonar找不到插件--Java

时间:2015-06-08 18:55:24

标签: java plugins ant sonarqube sonar-runner

我正在尝试从java执行声纳任务。下面是我正在执行的代码..

 @Override
  public void execute() {
    Properties allProps = new Properties();
    InputStream in;
    try {
        in = new FileInputStream(new File(getProjectBaseDir()+"\\"+SONAR_PROPERTY_FILE_NAME));
        allProps.load(in);


    } catch (FileNotFoundException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
   catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    performAnalysis(allProps);
  }

  void performAnalysis(Properties properties) {
    EmbeddedRunner.create()
      .addProperties(properties)
      .unmask("org.apache.tools.ant")
      .unmask("org.sonar.ant")
      .execute();
  }

执行时会抛出异常:

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 com.ihc.sonarApp.SonarTask.launchAnalysis(SonarTask.java:86)
    at com.ihc.sonarApp.SonarTask.execute(SonarTask.java:76)
    at com.ihc.sonar.util.Task.run(Task.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    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:745)
Caused by: You must install a plugin that supports the language 'Java'

我在buildpath中添加了这些jar:apache-ant-1.8.2.jar,sonar-ant-task-2.3.jar,sonar-java-plugin-3.0.jar和sonar-scm-svn-plugin- 1.0.jar。
我可以在localhost:9000访问声纳。

我做错了什么?是否存在我缺少的设置或罐子。

0 个答案:

没有答案