基于teamcity的持续集成实践(findbugs)

FindBugs 是一个静态分析工具,它检查类或者 JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题。

 

在teamcity中要通过ant脚本集成findbugs是非常简单的。

 

第一步,写我们的findbugs ant脚本文件。

 

<target name="findbugs-test">
      <findbugs home="${findbugs.home}"
                output="xml"
                outputFile="findbugs/findbugs-test.xml"
                jvmargs="-Xmx640m">
        <auxClasspath>
          <fileset dir="${basedir}/test/lib" >
            <include name="*.jar" />
          </fileset>
          <pathelement location="${emma.jar}" />
        </auxClasspath>
        <sourcePath path="${basedir}/test/src" />
        <class location="${basedir}/test/dist/test.jar" />
      </findbugs>
</target>

 

第二步,在teamcity里面配置导入findbugs报告。

 

XML Report Processing

Choose a report type to import. 

Import data from: <Do not import> PMD Surefire Ant JUnit NUnit FindBugs

Choose report format. Report paths:

Type report directories Type report directories:

To ensure monitoring swiftness specify more concrete paths.

Verbose output:

Maximum error limit:

Fail the build if the specified number of errors is exceeded.

Warnings limit:

Fail the build if the specified number of warnings is exceeded. Leave blank if there is no limit.

 

在此可以设置构建成功与否跟findbugs发现错误或者警告的数量关联在一起。

 

仔细研究一下findbugs发现的问题,其实还是有必要的,毕竟它通过bug patterns匹配出来的,大多数的error问题,我们还是尽量修复,对于waning的问题,我们可以加以留意。

 

第三步,查看findbugs报告

 

 

 

 



 

你可能感兴趣的:(xml,ant,JUnit,脚本)