简体   繁体   English

Maven FindBugs插件

[英]Maven FindBugs plugin

You have usage: findbugs-maven-plugin 你有用法: findbugs-maven-plugin

<project>
  [...]
  <reporting>
    [...]
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <version>1.2.1</version>
      <configuration>
        <xmlOutput>true|false</xmlOutput>
        <xmlOutputDirectory>directory location of findbugs xdoc xml report</xmlOutputDirectory>
        <threshold>High|Normal|Low|Exp|Ignore</threshold>
        <effort>Min|Default|Max</effort>
        <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
        <includeFilterFile>findbugs-include.xml</includeFilterFile>
        <visitors>FindDeadLocalStores,UnreadFields</visitors>
        <omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
        <onlyAnalyze>org.codehaus.mojo.findbugs.*</onlyAnalyze>
        <pluginList>/libs/fb-contrib/fb-contrib-2.8.0.jar</pluginList>
        <debug>true|false</debug>
        <relaxed>true|false</relaxed>
        <findbugsXmlOutput>true|false</findbugsXmlOutput>
        <findbugsXmlOutputDirectory>directory location of findbugs legact xml format report</findbugsXmlOutputDirectory>
      </configuration>
    </plugin>
    [...]
  </reporting>
  [...]
</project>

But once: 但有一次:

mvn site

I get: 我明白了:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: org.codehaus.mojo
ArtifactId: findbugs-maven-plugin
Version: 1.2.1

Reason: Unable to download the artifact from any repository

  org.codehaus.mojo:findbugs-maven-plugin:pom:1.2.1

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

Do you know why? 你知道为什么吗? What should I do? 我该怎么办?

Looking at the repository, your version should be 1.2, not 1.2.1 查看存储库,您的版本应为1.2,而不是1.2.1

Also, your configuration is wrong, you need to choose some of the options. 此外,您的配置错误,您需要选择一些选项。 So it should look like: 所以看起来应该是这样的:

    <plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>findbugs-maven-plugin</artifactId>
  <version>1.2</version>
  <configuration>
    <threshold>High</threshold>
    <effort>Default</effort>
  </configuration>
</plugin>

try that: 试试看:

<version>1.2</version>

http://repo2.maven.org/maven2/org/codehaus/mojo/findbugs-maven-plugin/ http://repo2.maven.org/maven2/org/codehaus/mojo/findbugs-maven-plugin/

Seems like they did a simple copy/paste error. 好像他们做了一个简单的复制/粘贴错误。

The report will be in target/site. 该报告将在目标/站点中。 Look at the file index.html in a browser, than look for project reports, then findbugs report. 在浏览器中查看文件index.html,而不是查找项目报告,然后查找findbugs报告。

As part of your parent project structure place site.xml into parent-project/src/site: 作为父项目结构的一部分,将site.xml放入parent-project / src / site:

 |--- src 
      |---site
            |---site.xml 

An example site.xml from "Better Builds with Maven" (a free book available online) should get you started. 来自“Better Builds with Maven”(一本免费在线书籍)的示例site.xml应该可以帮助您入门。

Once site.xml is created, execute mvn site from the parent project directory. 创建site.xml后,从父项目目录执行mvn site It will pick up your reporting settings including the firebug report. 它将获取您的报告设置,包括firebug报告。 Once the site is built, each child project will have directory /target/site, which contains index.html with a link to project reports. 构建站点后,每个子项目都将具有目录/目标/站点,其中包含index.html以及项目报告的链接。 The project reports should contain firebug reports. 项目报告应包含萤火虫报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM