我是声纳的初学者。当我创建声纳环境时,我只需按照官方手册运行样品。我修改了sonar-examples / projects / languages / java / ant / java-ant-simple / build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="Simple Java Project analyzed with the Sonar Ant Task" default="all" basedir="." xmlns:sonar="antlib:org.sonar.ant">
<!-- ========= Define the main properties of this project ========= -->
<property name="src.dir" value="src" />
<property name="build.dir" value="target" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="sonar.host.url" value="http://192.168.3.205:9001" />
<!-- Define the Sonar properties -->
<property name="sonar.projectKey" value="org.codehaus.sonar:example-java-ant" />
<property name="sonar.projectName" value="Simple Java Project analyzed with the Sonar Ant Task" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.language" value="java" />
<property name="sonar.sources" value="src" />
<property name="sonar.binaries" value="target/classes" />
<property name="sonar.working.directory" value="sonar" />
<!--property name="sonar.surefire.reportsPath" value="sonar/build/surefire-reports/findbugs-result.xml" /-->
<property name="sonar.sourceEncoding" value="UTF-8" />
<!-- Add your basic Sonar configuration below: sonar.jdbc.url, sonar.jdbc.username, etc. properties -->
<property name="sonar.jdbc.url" value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8" />
<property name="sonar.jdbc.username" value="sonar" />
<property name="sonar.jdbc.password" value="sonar" />
<!-- ========= Define "regular" targets: clean, compile, ... ========= -->
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${classes.dir}" fork="true" debug="true" includeAntRuntime="false" />
</target>
<!-- ========= Define Sonar target ========= -->
<target name="sonar" depends="compile">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<!-- Update the following line, or put the "sonar-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
<classpath path="/root/analyzers/sonar-ant-task-2.2.jar" />
</taskdef>
<!-- Execute Sonar -->
<sonar:sonar />
</target>
<!-- ========= The main target "all" ========= -->
<target name="all" depends="clean,compile,sonar" />
</project>
但是当我执行“ant”命令时,我有一个警告信息,表明findbugs的输出报告不在SurefireSensor预期的正确位置
[sonar:sonar] 13:29:49.785 INFO - Findbugs output report: /root/sonar-examples/projects/languages/java/ant/java-ant-simple/sonar/findbugs-result.xml
[sonar:sonar] 13:29:53.552 INFO - Execute Findbugs 2.0.3 done: 5975 ms
[sonar:sonar] 13:29:53.553 INFO - Sensor FindbugsSensor done: 5978 ms
[sonar:sonar] 13:29:53.553 INFO - Sensor SurefireSensor...
[sonar:sonar] 13:29:53.555 INFO - parsing /root/sonar-examples/projects/languages/java/ant/java-ant-simple/sonar/build/surefire-reports
[sonar:sonar] 13:29:53.556 WARN - Reports path not found: /root/sonar-examples/projects/languages/java/ant/java-ant-simple/sonar/build/surefire-reports
[sonar:sonar] 13:29:53.556 INFO - Sensor SurefireSensor done: 3 ms
我可以采取其他任何设置来解决问题吗? 谢谢!