findbugs将报告链接到源代码

时间:2018-03-14 11:48:08

标签: java maven static-analysis findbugs spotbugs

如何链接使用maven生成的Findbugs报告中的源代码文件?

要求是从Findbugs HTML报告导航到使用jxr插件生成的源代码文件交叉引用或实际的源代码文件。

使用

maven命令:mvn compile jxr:jxr findbugs:findbugs xml:transform

链接不适用于以下maven配置。在HTML报告中,我找不到任何导航到源文件的链接。但是,同样的工作在Jenkins构建中(我想一些插件需要注意)。

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>3.0.5</version>                
            <configuration>
                <effort>max</effort>
                <maxHeap>1024</maxHeap>
                <threshold>Low</threshold> <!-- Reports all bugs (other values are medium and max) -->
                <xmlOutput>true</xmlOutput>
                <failOnError>false</failOnError>
                <!-- findbugs output directory -->
                <outputDirectory>${env.WORKSPACE}/static_analysis/findbugs</outputDirectory>
                <xmlOutputDirectory>${env.WORKSPACE}/static_analysis/findbugs</xmlOutputDirectory>
                <findbugsXmlOutputDirectory>${env.WORKSPACE}/static_analysis/findbugs</findbugsXmlOutputDirectory>
                <xrefLocation>${env.WORKSPACE}/static_analysis/xref</xrefLocation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>xml-maven-plugin</artifactId>
            <version>1.0.2-beta-1</version>
            <configuration>
                <transformationSets>
                    <transformationSet>
                        <!-- Configures the source directory of XML files. -->
                        <dir>${env.WORKSPACE}/static_analysis/findbugs</dir>
                        <!-- Configures the directory in which the FindBugs report is written.-->
                        <outputDir>${env.WORKSPACE}/static_analysis</outputDir>
                        <stylesheet>fancy-hist.xsl</stylesheet>
                        <fileMappers>
                            <!-- Configures the file extension of the output files. -->
                            <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                                <targetExtension>.html</targetExtension>
                            </fileMapper>
                        </fileMappers>
                    </transformationSet>
                </transformationSets>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>findbugs</artifactId>
                    <version>3.0.1</version>
                </dependency>
            </dependencies>
        </plugin>

0 个答案:

没有答案