Sonar Xerces 冲突 Findbugs 和 ivy:report [英] Sonar Xerces conflict Findbugs and ivy:report

查看:31
本文介绍了Sonar Xerces 冲突 Findbugs 和 ivy:report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让声纳为具有包含 Findbugs 规则的质量配置文件的项目工作.

I am trying to get sonar to work for a project with a quality profile that includes Findbugs rules.

但是在分析项目时,sonar anttask 崩溃并出现以下错误:

However when analyzing the project the sonar anttask chrashes with the following error:

Caused by: java.io.IOException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
    at edu.umd.cs.findbugs.filter.Filter.<init>(Filter.java:134)
    at edu.umd.cs.findbugs.FindBugs.configureFilter(FindBugs.java:516)
    at edu.umd.cs.findbugs.FindBugs2.addFilter(FindBugs2.java:374)
    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:136)
    ... 50 more

在这个项目上,依赖关系是用 ivy 解决的,并且不依赖于像 xerces 和 xalan 这样的库.我也知道 xerces 包含在 JVM 中,并且总是很高兴处理......

on this project the dependencies are resolved with ivy, and has no dependencies on libraries like xerces and xalan. Also i understood that xerces is included included in the JVM and is always a pleasure to deal with...

我尝试添加各种依赖项以用于 sonar.libraries 属性,但没有任何效果,添加本地 JRE 库似乎也没有太大效果.

i've tried to add all sorts of dependencies to use for the sonar.libraries property but with no effect adding the local JRE libs also doesnt seem to have much effect.

我如何让这个 findbugs 分析运行(以独立于机器的方式)?

How do i get this findbugs analysis to run (in a machine independent way)?

(声纳版本:4.4,findbugs3 插件)

(Sonar version: 4.4, findbugs3 plugin)

更新:我刚刚发现冲突的根源是在构建的早期有一个目标,删除它可以修复它.当然,我也非常喜欢保留我的常春藤报告,所以问题仍然是我如何让它发挥作用......?

Update: I just found out the source of the conflict is having a target earlier in the build, removing it fixes it. Ofcourse i very much like to keep my ivy report as well, so the question is still how do i get this to work...?

推荐答案

在将我们的声纳升级到 v4.4 并将 Sonar 的质量配置文件从Sonar way"(Java)更改为Sonar way with Findbugs"之后,我也遇到了同样的问题抱怨 SAX2 驱动的异常:

After upgrading our sonar to v4.4 and changing Sonar's Quality profile from 'Sonar way' (Java) to 'Sonar way with Findbugs' I came accross this same exception complaining about the SAX2 driving:

Can not execute SonarQube analysis: Can not execute Find bugs: SAX2 driver class org.apache.xerces.parsers.SAXParser not found

我通过将驱动程序添加到我的 maven 命令来解决它:

I got around it by adding the driver to my maven command:

Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser

Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser

Bellow 是我的实际 maven 命令,用于清理、编译、运行测试、分析代码并将统计信息上传到声纳(在命令行中进行修复也可以满足您的非机器特定偏好修复,并且不需要更改您的源代码)

Bellow was my actual maven command to clean, compile, run test, analyse code and upload stats to sonar (having the fix in the command line also meets you non machine specific preference fix and requires no change to your source code)

$ mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.fai
lure.ignore=true -Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.
SAXParser sonar:sonar

这篇关于Sonar Xerces 冲突 Findbugs 和 ivy:report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆