Sonar Xerces Conflicts Findbugs and Ivy: Report

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

However, analyzing the project, antagonistic sonar tracks 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 

In this project, dependencies are resolved using ivy and have no dependency on libraries such as xerces and xalan. I also realized that xers are included in the JVM and it is always nice to deal with ...

I tried to add all kinds of dependencies to use for the sonar.libraries property, but without effect, adding local JRE libraries also does not have much effect.

How can I run this search analysis (offline)?

(sonar version: 4.4, findbugs3 plugin)

Update: I just found out that the source of the conflict has a target earlier in the assembly, and removing it corrects it. Of course, I really like to keep my report on ivy, so the question is how can I get this to work ...?

+7
ivy sonarqube findbugs xerces
source share
2 answers

After upgrading our sonar to version 4.4 and changing the sonar quality profile from Sonar Path (Java) to Sonar Path with Findbugs, I came to the same exception complaining about driving SAX2:

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

I went around it by adding a driver to my maven command:

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

Bellow was my actual maven team for cleaning, compiling, running a test, analyzing code, and loading statistics into sonar (the presence of a fix on the command line also corresponds to your non-standard preferences setting and does not require changes in the 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 
+10
source share

This may solve the problem: Download xerces-2.9.0.jar from:

http://www.java2s.com/Code/Jar/x/Downloadxercesjar.htm

Add this jar to (sonar root folder) \ extensions \ plugins

Try this command in the desired folder

mvn clean install sonar: sonar

Good luck.

0
source share

All Articles