How to generate HTML report with SonarQube-6.7.5

孤街浪徒 提交于 2019-12-13 03:13:06

问题


I am working on Spring4.0 Project with apache-maven-3.5.4 and Java 1.8 and would like to use SonarQube for code coverage and reports. I am using jacoco-maven-plugin 0.7.8 version plugin for that. I am able to see the details in the browser. But when I try to generate the report to HTML, I am not seeing the reports generated. I did a lot of research in Google and I followed the below

 mvn sonar:sonar -Dsonar.issuesreport.html.enable=true 

and i added the entry in POM as well. But the reports are not generated. Kindly help me in getting this resolved. Below is my configuration in POM file.

 <!-- Sonar -->
 <sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco- 
   it.exec</sonar.jacoco.itReportPath>
 <sonar.groovy.binaries>target/classes</sonar.groovy.binaries>

 <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>3.4.0.905</version>
 </plugin>

回答1:


Issue report plugin was deprecated, so this option will not work with recent versions of SonarQube. SonarQube is able to display coverage and reports via its UI, so this functionality was dropped.




回答2:


Uh, don't you have an issue with your pom? I see

<sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco- 
   it.exec</sonar.jacoco.itReportPath>

With the default maven directory layout, the target directory is inside ${project.basidir}. I would expect an issue like "no such file or directory" when the plugin tries to generate the reports, unless it is created on the fly.

Try with

<sonar.jacoco.itReportPath>${project.basedir}/target/jacoco- 
   it.exec</sonar.jacoco.itReportPath>

or maybe even

<sonar.jacoco.itReportPath>target/jacoco- 
   it.exec</sonar.jacoco.itReportPath>

depending on what the parent directory is set to.




回答3:


In recent version, you have to generate your own reports based on what api/issues gives you.

A simple JS script can do trick.



来源:https://stackoverflow.com/questions/51973287/how-to-generate-html-report-with-sonarqube-6-7-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!