java 如何为使用 sonarqube-5.4 和 maven 报告的问题生成 html 报告?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36147724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 01:00:01  来源:igfitidea点击:

How to generate html report for issues reported using sonarqube-5.4 and maven?

javamavensonarqube

提问by S.B

I have checked the link:sonarqube issues report,but not clear on how to achive it during maven build.

我检查了链接:sonarqube 问题报告,但不清楚如何在 maven 构建期间实现它。

采纳答案by Simon Brandhof - SonarSource

As documented the Issues Report Plugin is not compatible with versions 5.1 and greater. SonarLint for Command-Lineshould be used to get the same feature. It is simple to enable with Maven:

正如所记录的,问题报告插件与 5.1 及更高版本不兼容。应使用命令行的 SonarLint来获得相同的功能。使用 Maven 启用很简单:

mvn sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true

Paths to the generated HTML reports are displayed in logs:

生成的 HTML 报告的路径显示在日志中:

[INFO] HTML Issues Report generated: /xxx/target/sonar/issues-report/issues-report.html
[INFO] Light HTML Issues Report generated: /xxx/target/sonar/issues-report/issues-report-light.html
[INFO] ANALYSIS SUCCESSFUL

回答by VinayVeluri

Cycle of steps.

步骤循环。

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

As per the source, build should happen before the analysis. sonar:sonartriggers maven surefire plugin to execute.

根据来源,构建应该在分析之前发生。sonar:sonar触发 maven surefire 插件执行。