When i run the Sonar-Scanner got Execution Failure in terminal/commandline

Hi All,

I want to generate reports through command line or from terminal NOT FROM BROWSER

NOTE:- I want to verify through typescript the code sonar-scanner

I have install sonarqube-8.5.1.38104 and sonar-scanner-4.5.0.2216-linux and react-app-sonarqube.

In react-app-sonarqube i have all files are there screenshot is

sonar.projectKey=sonar-reactapp2
sonar.projectName=sonar-reactapp2
sonar.projectVersion=1.0

sonar.language=js

sonar.sources=src
sonar.tests=src
sonar.sourceEncoding=UTF-8


sonar.exclusions=src/**/*.spec.js
#sonar.test.inclusions=src/**/*.spec.js
sonar.test.inclusions=**/*.test.js
sonar.coverage.exclusions=src/**/*.spec.js,src/**/*.mock.js,node_modules/*,coverage/lcov-report/*
#sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.dynamicAnalysis=reuseReports
#sonar.testExecutionReportPaths=test-reports.xml
sonar.cobertura.reportPath=target/reports/coverage.xml

#mvn sonar:sonar 
sonar.analysis.mode=preview 
sonar.issuesReport.xml.enable=true

#sonar.coverageReportPaths=genericTestExecution.xml

And here is my below screenshot which i have run from terminal


and

I’m new to sonar and i dont know to generate reports through terminal or command line

Please help me how can i solve and any link or commands

@ganncamp @Andre

Hi,

Welcome to the community!

Please don’t @ people who haven’t already participated in your thread.

 
Ann

Ohh Sorry i will remove it

can you help me with above issue

Hi @Rashid,

Regarding your Sonar scanning execution failure, please read the Generic Test Data documentation to double-check your xml format of your test report. It should look something like this:

<coverage version="1">
  <file path="xources/hello/NoConditions.xoo">
    <lineToCover lineNumber="6" covered="true"/>
    <lineToCover lineNumber="7" covered="false"/>
  </file>
  <file path="xources/hello/WithConditions.xoo">
    <lineToCover lineNumber="3" covered="true" branchesToCover="2" coveredBranches="1"/>
  </file>
</coverage>

Also, in the sonar project properties you posted, you show this:

So sonar.testExecutionReportPaths is commented out, yet we see that it is being parsed/read in the logs. Please double-check your sonar project properties.

To your 2nd question: There isn’t a nice way to generate reports through the terminal or command line. SonarQube was meant to be interacted through UI and thus the browser.

But if you insist on terminal alone, you can use our Web API endpoints to curl for information in a script, for example. You can find more information here.

Joe