简体   繁体   English

Maven Findbugs在站点生命周期中不生成报告

[英]Maven Findbugs not producing reports in site lifecycle

I'm trying to create the Findbugs HTML report for the site reports. 我正在尝试为站点报告创建Findbugs HTML报告。 I finally got Findbugs to actually run (before it would skip) because I had to include the goal findbugs in the <build> phase under the find bugs report. 我终于让Findbugs实际运行(在跳过之前),因为我必须在find bugs报告的<build>阶段中包含目标findbugs However, the findbugs.html report is not being generated even though I have findbugs defined in my <reporting> section. 但是,即使我在<reporting>部分中定义了findbugs.html也不会生成findbugs.html <reporting>

Here's my configuration for Findbugs: 这是我的Findbugs配置:

<build>
    <plugins>
        ...
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.5.2</version>
            <configuration>
                <xmlOutput>true</xmlOutput>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>findbugs</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
      ....
    <plugins>
</build>
....
<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.5.2</version>
            <configuration>
                <xmlOutput>true</xmlOutput>
                <failOnError>false</failOnError>
                <xmlOutput>true</xmlOutput>
                <skip>false</skip>
            </configuration>
        </plugin>
    </plugins>
<reporting>

My execution looks like this: 我的执行如下所示:

$ mvn clean site
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building project 2.0.4
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ crypto ---
[INFO] Deleting target
[INFO] 
[INFO] --- maven-site-plugin:3.3:site (default-site) @ crypto ---
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.7
[INFO] configuring report plugin org.codehaus.mojo:findbugs-maven-plugin:2.5.2
[INFO] configuring report plugin org.apache.maven.plugins:maven-pmd-plugin:3.0.1
[INFO] configuring report plugin org.apache.maven.plugins:maven-javadoc-plugin:2.9.1
[INFO] 
[INFO] >>> maven-javadoc-plugin:2.9.1:aggregate (report:aggregate) @ crypto >>>
[INFO] 
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) @ crypto ---
Retrieving document at 'src/main/wsdl/Tokenizer.wsdl'.
[INFO] 
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ crypto ---
[INFO] Source directory: target/generated-sources added.
[INFO] 
[INFO] <<< maven-javadoc-plugin:2.9.1:aggregate (report:aggregate) @ crypto <<<
[INFO] 
[INFO] >>> maven-javadoc-plugin:2.9.1:test-aggregate (report:test-aggregate) @ crypto >>>
[INFO] 
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) @ crypto ---
Retrieving document at 'src/main/wsdl/SafeNetTokenizer.wsdl'.
[INFO] 
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ crypto ---
[INFO] Source directory: /Users/david/workspace/KeyManagment-trunk/target/generated-sources added.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ crypto ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/david/workspace/KeyManagment-trunk/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ crypto ---
[INFO] Compiling 13 source files to /Users/david/workspace/KeyManagment-trunk/target/classes
[INFO] 
[INFO] --- findbugs-maven-plugin:2.5.2:findbugs (default) @ crypto ---
[INFO] Fork Value is true
    [java] The following classes needed for analysis were missing:
    [java]   com.ingrian.internal.ilc.IngrianLogger
    [java]   com.ingrian.security.nae.NAESession
    [java]   com.ingrian.internal.config.Config
    [java]   com.ingrian.security.nae.NAEKey
    [java]   com.ingrian.security.nae.HmacSHA256
    [java]   com.ingrian.internal.xml.XMLException
    [java]   com.ingrian.security.nae.NAEAESCipher
    [java]   com.ingrian.security.nae.IngrianProvider
    [java] Warnings generated: 310
    [java] Missing classes: 8
[INFO] Done FindBugs Analysis....
[INFO] 
[INFO] --- maven-bundle-plugin:2.3.7:manifest (bundle-manifest) @ crypto ---
[INFO] 
[INFO] <<< maven-javadoc-plugin:2.9.1:test-aggregate (report:test-aggregate) @ crypto <<<
[INFO] 
[INFO] >>> maven-javadoc-plugin:2.9.1:javadoc (report:javadoc) @ crypto >>>
[INFO] 
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) @ crypto ---
Retrieving document at 'src/main/wsdl/SafeNetTokenizer.wsdl'.
[INFO] 
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ crypto ---
[INFO] Source directory: /Users/david/workspace/KeyManagment-trunk/target/generated-sources added.
[INFO] 
[INFO] <<< maven-javadoc-plugin:2.9.1:javadoc (report:javadoc) @ crypto <<<
[INFO] 
[INFO] >>> maven-javadoc-plugin:2.9.1:test-javadoc (report:test-javadoc) @ crypto >>>
[INFO] 
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) @ crypto ---
Retrieving document at 'src/main/wsdl/SafeNetTokenizer.wsdl'.
[INFO] 
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ crypto ---
[INFO] Source directory: /Users/david/workspace/KeyManagment-trunk/target/generated-sources added.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ crypto ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/david/workspace/KeyManagment-trunk/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ crypto ---
[INFO] Compiling 2 source files to /Users/david/workspace/KeyManagment-trunk/target/classes
[INFO] 
[INFO] --- findbugs-maven-plugin:2.5.2:findbugs (default) @ crypto ---
[INFO] Fork Value is true
    [java] The following classes needed for analysis were missing:
    [java]   com.ingrian.internal.ilc.IngrianLogger
    [java]   com.ingrian.security.nae.NAESession
    [java]   com.ingrian.internal.config.Config
    [java]   com.ingrian.security.nae.NAEKey
    [java]   com.ingrian.security.nae.HmacSHA256
    [java]   com.ingrian.internal.xml.XMLException
    [java]   com.ingrian.security.nae.NAEAESCipher
    [java]   com.ingrian.security.nae.IngrianProvider
    [java] Warnings generated: 310
    [java] Missing classes: 8
[INFO] Done FindBugs Analysis....
[INFO] 
[INFO] --- maven-bundle-plugin:2.3.7:manifest (bundle-manifest) @ crypto ---
[INFO] 
[INFO] <<< maven-javadoc-plugin:2.9.1:test-javadoc (report:test-javadoc) @ crypto <<<
[WARNING] No project URL defined - decoration links will not be relativized!
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin.
[INFO] Skipped "JavaDocs" report, file "apidocs/index.html" already exists for the English version.
[INFO] Skipped "Test JavaDocs" report, file "testapidocs/index.html" already exists for the English version.
[INFO] Generating "About" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Plugin Management" report    --- maven-project-info-reports-plugin:2.7
...
[INFO] Generating "Project Team" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Summary" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependencies" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "CPD Report" report    --- maven-pmd-plugin:3.0.1
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO] Generating "PMD Report" report    --- maven-pmd-plugin:3.0.1
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO] Generating "JavaDocs" report    --- maven-javadoc-plugin:2.9.1
[INFO] 
Loading source files for package com.ihotelier.crypto...
Loading source files for package com.safenet.tokenization.wsclient...
Constructing Javadoc information...
Standard Doclet version 1.7.0_13
Building tree for all the packages and classes...
Generating ...
4 warnings
[WARNING] Javadoc Warnings
[WARNING] ...
[INFO] Fixed Javadoc frame injection vulnerability (CVE-2013-1571) in 1 files.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:30.831s
[INFO] Finished at: Tue Nov 05 14:02:04 EST 2013
[INFO] Final Memory: 40M/115M
[INFO] ------------------------------------------------------------------------

I see findbugs being configured in the beginning of my execution under the maven-site-plugin . 我看到在执行开始时在maven-site-plugin配置了findbugs。 I see Findbugs executing (twice!) after maven-compiler-plugin runs. 我看到运行maven-compiler-plugin后,Findbugs正在执行(两次!)。 (I may change the goal to process-classes to prevent this double execution. I see 8 errors, but we don't really use those classes. (I need to figure out how to skip over these classes). (我可能将目标更改为流程类,以防止这种双重执行。我看到8个错误,但我们实际上并没有使用那些类。(我需要弄清楚如何跳过这些类)。

Near the end of the build, I see the PMD and CPD Reports being generated ( Generating "CPD Report" report ), but not Findbugs. 在构建即将结束时,我看到正在生成PMD和CPD报告( Generating "CPD Report" report ),但未生成Findbugs。

When I look at the build results, I see target/findbugs.xml and target/findbugsXML.xml , but nothing under target/site . 查看构建结果时,看到的是target/findbugs.xmltarget/findbugsXML.xml ,但在target/site下什么也没有。

Sorry for the excessive output. 对不起,输出过多。 I want to make sure I wasn't skipping anything important. 我想确保我没有跳过任何重要的事情。

Shows you what I know about Maven. 向您展示我对Maven的了解。 Two things I discovered: 我发现了两件事:

  • Running site does not execute package (although compile does run -- probably because it's needed for some of the reports). 正在运行的site不会执行package (尽管compile会运行-可能是因为某些报告需要它)。
  • Findbugs cannot produce a site report unless the package is done first. 除非首先完成该程序包,否则Findbugs无法生成站点报告。

I moved findbugs plugin to run in the package phase, so it doesn't run twice, and everything now seems fine. 我将findbugs插件移到了package阶段,因此它不会运行两次,现在一切似乎都很好。

I think it's similar to the surefire reports issues , so try adding the site plugin to the <pluginManagement> section: 我认为这与surefire报告问题类似,因此请尝试将站点插件添加到<pluginManagement>部分:

<pluginManagement>
   <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
     </plugin>
   </plugins>
</pluginManagement>

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

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