Skip to content

Sonar formatter fails to format tests.xml as per the requirements of sonar version 2025.XX #81

@Sankalan13

Description

@Sankalan13

The new sonar version requires the reports.xml file to be in a particular format, using the current formatter works well with the old versions but fails for the new version of sonar (2025.XX versions).

Issues with the generated xml:

  • The first line which defines the xml version and encoding type is now not supported in the new version
  • The curly quotes is not accepted by the server anymore, all quotes needs to be changed to straight quotes

There might be more errors, I'll update this post as and when I run into more issues when running this in the CI

Attached log of the failure:

08:17:22.959 ERROR Error during parsing of generic test execution report '/home/circleci/project/sonar/test-report.xml'. Look at the SonarQube documentation to know the expected XML format.
org.sonar.api.utils.MessageException: Error during parsing of generic test execution report '/home/circleci/project/sonar/test-report.xml'. Look at the SonarQube documentation to know the expected XML format.
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[135,5]
Message: Open quote is expected for attribute "name" associated with an  element type  "testCase".
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
        at java.xml/javax.xml.stream.util.StreamReaderDelegate.next(Unknown Source)
        at org.codehaus.stax2.ri.Stax2ReaderAdapter.next(Stax2ReaderAdapter.java:129)
        at org.codehaus.staxmate.in.SMHierarchicCursor.getNext(SMHierarchicCursor.java:79)
        at org.sonar.scanner.genericcoverage.GenericTestExecutionReportParser.parseFiles(GenericTestExecutionReportParser.java:130)
        at org.sonar.scanner.genericcoverage.GenericTestExecutionReportParser.parseRootNode(GenericTestExecutionReportParser.java:103)
        at org.sonar.scanner.genericcoverage.GenericTestExecutionReportParser.lambda$parse$0(GenericTestExecutionReportParser.java:86)
        at org.sonar.scanner.genericcoverage.StaxParser.parse(StaxParser.java:104)
        at org.sonar.scanner.genericcoverage.StaxParser.parse(StaxParser.java:84)
        at org.sonar.scanner.genericcoverage.GenericTestExecutionReportParser.parse(GenericTestExecutionReportParser.java:87)
        at org.sonar.scanner.genericcoverage.GenericTestExecutionReportParser.parse(GenericTestExecutionReportParser.java:76)
        at org.sonar.scanner.genericcoverage.GenericTestExecutionSensor.execute(GenericTestExecutionSensor.java:87)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
        at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
        at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:201)
        at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:197)
        at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:170)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
        at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:356)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
        at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:142)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
        at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:151)
        at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:66)
        at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:52)

08:17:22.963 DEBUG Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$388/0x00007f3fb42bfa18@5e9456ae during JVM shutdown

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions