2017-05-16 210 views
1

我必須從Jenkins運行findBugs並生成報告到特定文件。我正在尋找執行此操作的詳細步驟。在Jenkins生成findBugs報告

我已經添加在詹金斯的插件,並有低於在pom.xml

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的和生成報告?

回答

0

您需要這在FindBugs的,Maven的插件配置部分:

  <findbugsXmlOutput>true</findbugsXmlOutput> 
      <findbugsXmlWithMessages>true</findbugsXmlWithMessages> 
      <xmlOutput>true</xmlOutput> 

此外,您還需要運行Maven的目標的FindBugs:FindBugs的。你可以在這裏的插件描述頁面的「如何使用」部分找到詳細信息:https://wiki.jenkins-ci.org/display/JENKINS/FindBugs+Plugin

+0

有沒有辦法在Jenkins中生成可視報告? – OnePlus