JavaXmlSensor fails tfs build after SonarQube upgrade

Must-share information (formatted with Markdown):

  • SonarQube Version 8.5.1.38104
  • Scanner, Plugin 4.10.0.19059 / 4.4.0.2170
  • One of our tfs builds fails after SonarQube upgrade
  • JavaXmlSensor is picking up files that should be excluded
INFO: Sensor JavaXmlSensor [java]
INFO: 286 source files to be analyzed
INFO: 15/286 files analyzed, current file: ... wrdSh01.xml
##[error]Exception in thread "Report about progress of Java XML analyzer"
Exception in thread "Report about progress of Java XML analyzer"
##[error]Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Report about progress of Java XML analyzer"

We had this problem before and solved it by deleting the unneeded plugins but that’s no longer possible.

I added the sonar.web.javaOpts=-Xmx1024m option but that still gave the error and we don’t want to analyse these files anyway.

I tried adding sonar.exclusions=**/*.xml to the prepare step and SonarQube server itself

INFO:   Excluded sources: **/*.xml
INFO:   Excluded sources for duplication: *.xsd, **/Generated/*.cs

I changed the file suffix for XML to .xml_we_dont_want_this on SonarQube server

I tried the sonar.language option to only scan csharp but that seems deprecated.

I’m basically out of ideas and disabled the sonarqube steps for now.

Hello @Valentijn,

Your use case is indeed quite surprising and should be correctly supported by our analyzers. This means that the JavaXmlSensor should indeed NOT be able to consume XML files if they are excluded. And you are correctly excluded them if they are part of the MAIN sources.

Can you check that wrdSh01.xml and all the other XML files are not part of TEST sources?
Because if it’s the case, you would then need to also exclude them with sonar.test.exclusions=**/*.xml

Cheers,
Michael

Spot on they where part of test sources and I didn’t know they had separate exclusions
Thanks a lot

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.