Maven FindBugs 插件

发布于 2024-07-13 06:11:30 字数 2187 浏览 6 评论 0原文

您有用法: 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>

但有一次:

mvn site

我得到:

[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 have usage: 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

奈何桥上唱咆哮 2024-07-20 06:11:30

查看存储库,您的版本应该是1.2,而不是1.2.1

另外,您的配置是错误的,您需要选择一些选项。 所以它应该看起来像:

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

Looking at the repository, your version should be 1.2, not 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>
晚雾 2024-07-20 06:11:30

尝试一下:

<version>1.2</version>

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

看起来他们做了一个简单的复制/粘贴错误。

try that:

<version>1.2</version>

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

Seems like they did a simple copy/paste error.

耶耶耶 2024-07-20 06:11:30

报告将位于目标/站点。 在浏览器中查看文件index.html,然后查找项目报告,然后查找bugs报告。

The report will be in target/site. Look at the file index.html in a browser, than look for project reports, then findbugs report.

暮年慕年 2024-07-20 06:11:30

作为父项目结构的一部分,将 site.xml 放入parent-project/src/site:

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

“Better Builds with Maven”(在线免费书籍)中的 site.xml 示例应该可以帮助您入门。

创建 site.xml 后,从父项目目录执行 mvn site 。 它将获取您的报告设置,包括萤火虫报告。 站点构建完成后,每个子项目都会有目录 /target/site,其中包含带有项目报告链接的 index.html。 项目报告应包含萤火虫报告。

As part of your parent project structure place site.xml into 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.

Once site.xml is created, execute mvn site from the parent project directory. It will pick up your reporting settings including the firebug report. Once the site is built, each child project will have directory /target/site, which contains index.html with a link to project reports. The project reports should contain firebug reports.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文