首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Jenkins中生成findBugs报告

在Jenkins中生成findBugs报告
EN

Stack Overflow用户
提问于 2017-05-16 08:46:39
回答 1查看 3.1K关注 0票数 1

我必须从Jenkins运行findBugs并将报告生成到特定的文件。我正在寻找详细的步骤来做到这一点。

我已经在Jenkins中添加了插件,并在pom.xml中添加了以下内容

代码语言:javascript
复制
enter code here

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.4.0</version>
            <executions>
                <execution>
                    <id>findbug</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <effort>Max</effort>
                <threshold>Low</threshold>
                <findbugsXmlOutputDirectory>
                    ${project.build.directory}/findbugs
                </findbugsXmlOutputDirectory>
                <failOnError>false</failOnError>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>xml-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
                <execution>
                    <phase>verify</phase>
                    <goals>
                        <goal>transform</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <transformationSets>
                    <transformationSet>
                        <dir>${project.build.directory}/findbugs</dir>
                        <outputDir>${project.build.directory}/findbugs</outputDir>
                        <stylesheet>fancy-hist.xsl</stylesheet>
                        <fileMappers>
                            <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>2.0.0</version>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>3.0.3</version>
            <executions>
                <execution>
                    <id>failing-on-high</id>
                    <phase>install</phase>
                    <goals>
                        <goal>findbugs</goal>
                        <goal>check</goal>
                    </goals>
                    <configuration>
                        <effort>Max</effort>
                        <threshold>Low</threshold>
                        <failOnError>true</failOnError>
                    </configuration>
                </execution>
            </executions>
        </plugin>

如何运行findBugs并生成报表?

EN

回答 1

Stack Overflow用户

发布于 2017-06-01 22:47:48

您需要在findbugs-maven-plugin配置部分中找到以下内容:

代码语言:javascript
复制
          <findbugsXmlOutput>true</findbugsXmlOutput>
          <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
          <xmlOutput>true</xmlOutput>

此外,您还需要运行maven目标findbugs:findbugs。您可以在插件描述页面的“如何使用”部分找到详细信息:https://wiki.jenkins-ci.org/display/JENKINS/FindBugs+Plugin

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43990832

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档