求教sonar ant task使用findbugs问题
各位大虾,我的问题是这样的:
sonarqube版本4.4-RC2
我修改了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生成的result与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
我在网上找了半天没找到解决方案, 希望高人指点我一下,可以通过配置来解决吗,小弟在此先谢过
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题已经解决了, 加入<property name="sonar.junit.reportsPath" value="sonar" /> 配置即可
我也是,规则改成
Sonar way with Findbugs之后,执行一直有问题,Sonar way正常