Maven的SpotBugs未生成报告。

huangapple go评论96阅读模式
英文:

maven spotbugs doesn't generate report

问题

我根据其网站上的文档配置了Maven SpotBugs插件,但它没有生成报告。

运行时我看到了这行内容:

mvn site -X

> [INFO] 15 reports detected for
> maven-project-info-reports-plugin:3.1.0: ci-management, dependencies,
> dependency-info, dependency-management, distribution-management,
> index, issue-management, licenses, mailing-lists, modules,
> plugin-management, plugins, scm, summary, team [DEBUG] ******
> SpotBugsMojo canGenerateReport
> ******* [DEBUG] canGenerate is false

请注意最后一行!

英文:

I configured maven spotbugs plugin based on docs on its website, but it doesn't generate report.

This was a line I saw when running

mvn site -X

> [INFO] 15 reports detected for
> maven-project-info-reports-plugin:3.1.0: ci-management, dependencies,
> dependency-info, dependency-management, distribution-management,
> index, issue-management, licenses, mailing-lists, modules,
> plugin-management, plugins, scm, summary, team [DEBUG] ******
> SpotBugsMojo canGenerateReport  
> ******* [DEBUG] canGenerate is false

Please watch the last line!

答案1

得分: 1

通过检查源代码,我发现在能够运行任何检查之前,需要在目标(target)文件夹中生成一个"classes"文件夹。

因此,正确的运行方式是:

mvn compile site

这会在目标(target)文件夹中生成"classes",并在控制台上输出以下日志:

> [INFO] 检测到 15 个报告用于 maven-project-info-reports-plugin:3.1.0: ci-management、dependencies、dependency-info、dependency-management、distribution-management、index、issue-management、licenses、mailing-lists、modules、plugin-management、plugins、scm、summary、team [DEBUG] ******
> SpotBugsMojo 可以生成报告 ******* [DEBUG] 可以生成的源代码为真
> [DEBUG] ****** SpotBugsMojo 执行 Spotbugs ******* [DEBUG] ******
> 正在执行 SpotBugsMojo
英文:

I found out through checking source code that it needs to have classes folder generated in target before being able to run any check.

So right way to run it is

mvn compile site

Which generates classes in target folder and writes this log to console:

> [INFO] 15 reports detected for
> maven-project-info-reports-plugin:3.1.0: ci-management, dependencies,
> dependency-info, dependency-management, distribution-management,
> index, issue-management, licenses, mailing-lists, modules,
> plugin-management, plugins, scm, summary, team [DEBUG] ******
> SpotBugsMojo canGenerateReport ******* [DEBUG] canGenerate Src is true
> [DEBUG] ****** SpotBugsMojo executeSpotbugs ******* [DEBUG] ******
> Executing SpotBugsMojo *******

huangapple
  • 本文由 发表于 2020年8月25日 03:30:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/63567583.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定