声纳Xerces冲突Findbugs和常春藤:报告 [英] Sonar Xerces conflict Findbugs and ivy:report

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

问题描述

我正在尝试让声纳用于具有包括Findbugs规则的质量配置文件的项目.

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

但是,当分析项目时,声纳任务会崩溃,并出现以下错误:

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的质量配置文件从声纳方式"(Java)更改为使用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

以下是我实际的清理,编译,运行测试,分析代码并将统计信息上传到声纳的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

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

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