基于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:

findbugs/findbugs-test.xml findbugs/findbugs-test1.xml findbugs/findbugs-test2.xml

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报告

 

 

 

 



 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值