java.lang.IllegalStateException:未启动的异常发生在行<sonar:sonar>

时间:2018-08-07 15:59:56

标签: java ant sonarqube

我正在尝试为我的项目配置声纳。首先,我在本地环境中尝试。下面是我的配置

<project name="dev" default="war" xmlns:sonar="antlib:org.sonar.ant">

<!-- Define the SonarQube global properties (the most usual way is to pass these properties via the command line) -->
  <property name="sonar.host.url" value="http://localhost:9000/sonar" />

<!-- Define the SonarQube project properties -->
  <property name="sonar.projectKey" value="org.codehaus.sonar:sonarqube-scanner-ant" />
  <property name="sonar.projectName" value="Example of SonarQube Scanner for Ant Usage" />
  <property name="sonar.projectVersion" value="1.0" />
  <property name="sonar.language" value="java" />
  <property name="sonar.sources" value="src" />
  <property name="sonar.java.binaries" value="build" />
  <property name="sonar.java.libraries" value="lib/*.jar" />
  <property name="sonar.sourceEncoding" value="UTF-8" />

<!-- Code for clean compile the java files code comes here -->

<!-- Define SonarQube Scanner for Ant Target -->
  <target name="sonar"> 
    <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
      <!-- Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
      <classpath path="C:/eclipse-oxygen2-wf/plugins/org.apache.ant_1.10.1.v20170504-0840/lib/sonarqube-ant-task-2.5.jar" />
    </taskdef>

    <sonar:sonar/>

  </target>

</project>

我正在使用sonarqube7.2.1 ansonarqube-ant-task-2.5.jar。当我运行以下命令时,它给了我IllegalStateException

ant sonar

我这里缺少什么吗?

下面是控制台输出

Buildfile: C:\workspace\project_sonar\build.xml
sonar:
[sonar:sonar] Apache Ant(TM) version 1.10.1 compiled on February 2 2017
[sonar:sonar] SonarQube Ant Task version: 2.5
[sonar:sonar] Loaded from: file:/C:/sonar/sonarqube-ant-task-2.5.jar
[sonar:sonar] User cache: C:\Users\Usha\.sonar\cache

BUILD FAILED
C:\workspace\project_sonar\build.xml:231: java.lang.IllegalStateException: not started

0 个答案:

没有答案