findbugs的ant脚本实践
<?xml version="1.0" encoding="UTF-8"?> <project name="codeCheck" default="findbugs"> <property file="confi.properties" /> <path id="findbugs.lib">
<fileset dir="${findbugs.home}/lib">
<include name="findbugs-ant.jar"/>
</fileset>
</path> <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
<classpath refid="findbugs.lib" />
</taskdef> <taskdef name="computeBugHistory" classname="edu.umd.cs.findbugs.anttask.ComputeBugHistoryTask">
<classpath refid="findbugs.lib" />
</taskdef> <taskdef name="setBugDatabaseInfo" classname="edu.umd.cs.findbugs.anttask.SetBugDatabaseInfoTask">
<classpath refid="findbugs.lib" />
</taskdef> <taskdef name="mineBugHistory" classname="edu.umd.cs.findbugs.anttask.MineBugHistoryTask">
<classpath refid="findbugs.lib" />
</taskdef> <!-- hi,look, this is procedure -->
<target name="findbugs">
<antcall target="analyze" />
<antcall target="mine" />
<antcall target="report" />
</target> <!-- findbugs task definition -->
<target name="analyze">
<findbugs home="${findbugs.home}"
projectName="${project.name}"
output="xml:withMessages"
outputFile="out.xml"
reportLevel="low"
effort="max"
includeFilter="includerFilter.xml"
>
<auxClasspath path="${project.home}/${depend.lib.dir1}/xxx.jar" />
<auxClasspath path="${project.home}/${depend.lib.dir2}/xxxjar" />
<class location="${project.home}/${class1.dir}" />
<class location="${project.home}/${class2.dir}" />
</findbugs>
</target> <!-- mine task -->
<target name="mine"> <!-- Set info to the latest analysis -->
<setBugDatabaseInfo home="${findbugs.home}"
withMessages="true"
name="${project.version}"
input="out.xml"
output="out-rel.xml"/> <!-- Checking if history file already exists (out-hist.xml) -->
<condition property="mining.historyfile.available">
<available file="out-hist.xml"/>
</condition>
<condition property="mining.historyfile.notavailable">
<not>
<available file="out-hist.xml"/>
</not>
</condition> <!-- this target is executed if the history file do not exist (first run) -->
<antcall target="history-init">
<param name="data.file" value="out-rel.xml" />
<param name="hist.file" value="out-hist.xml" />
</antcall>
<!-- else this one is executed -->
<antcall target="history">
<param name="data.file" value="out-rel.xml" />
<param name="hist.file" value="out-hist.xml" />
<param name="hist.summary.file" value="out-hist.txt" />
</antcall>
</target> <!-- Initializing history file -->
<target name="history-init" if="mining.historyfile.notavailable">
<copy file="${data.file}" tofile="${hist.file}" />
</target> <!-- Computing bug history -->
<target name="history" if="mining.historyfile.available">
<!-- Merging ${data.file} into ${hist.file} -->
<computeBugHistory home="${findbugs.home}"
withMessages="true"
output="${hist.file}">
<dataFile name="${hist.file}"/>
<dataFile name="${data.file}"/>
</computeBugHistory> <!-- Compute history into ${hist.summary.file} -->
<mineBugHistory home="${findbugs.home}"
formatDates="true"
noTabs="true"
input="${hist.file}"
output="${hist.summary.file}"/>
</target> <!-- report task -->
<target name="report">
<xslt in="out-rel.xml"
out="rep/default.html"
style="${findbugs.home}/src/xsl/default.xsl" /> <xslt in="out-rel.xml"
out="rep/fancy.html"
style="${findbugs.home}/src/xsl/fancy.xsl" /> <xslt in="out-hist.xml"
out="rep/fancy-hist.html"
style="${findbugs.home}/src/xsl/fancy-hist.xsl" /> <xslt in="out-rel.xml"
out="rep/plain.html"
style="${findbugs.home}/src/xsl/plain.xsl" /> <xslt in="out-rel.xml"
out="rep/sum.html"
style="${findbugs.home}/src/xsl/summary.xsl" /> <xslt in="out-rel.xml"
out="rep/all.csv"
style="xsl/s4csv.xsl" /> <xslt in="out-rel.xml"
out="rep/all.html"
style="xsl/s4html.xsl" /> <!-- Checking if history file already exists (out-hist.xml) -->
<condition property="generate.available">
<available file="out-hist.xml"/>
</condition>
<!-- this target is executed if the history file do not exist (first run) -->
<antcall target="generate_email_report">
</antcall>
</target> <!-- generate report, current revision's New warnings -->
<target name="generate_email_report" if="generate.available">
<delete file="rep/new.csv" />
<copy file="out-hist.xml" tofile="out-hist-copy.xml" />
<xslt in="out-hist-copy.xml"
out="rep/news.csv"
style="xsl/s4csv_news.xsl" />
<xslt in="out-hist-copy.xml"
out="rep/news.html"
style="xsl/s4html_news.xsl" />
<delete file="out-hist-copy.xml" />
<!-- sned_email -->
<condition property="send.available">
<available file="rep/news.html" />
</condition>
<antcall target="send_email">
</antcall>
</target> <!-- send email -->
<target name="send_email" if="send.available">
<!-- TODO -->
</target> </project>
findbugs的ant脚本实践的更多相关文章
- 利用ant脚本 自动构建svn增量/全量 系统程序升级包
首先请允许我这样说,作为开发或测试,你一定要具备这种 本领.你可以手动打包.部署你的工程,但这不是最好的方法.最好的方式就是全自动化的方式.开发人员提交了代码后,可以自动构建.打包.部署到测试环境. ...
- [自动运维]ant脚本打包,上传文件到指定服务器,并部署
1.根节点使用,表示根目录为当前目录,默认启动的target为build,项目名称为othersysm, <project basedir="." default=" ...
- 利用Ant脚本生成war包的详细步骤
使用ant脚本前的准备 1.下载一个ant安装包.如:apache-ant-1.8.4-bin.zip.解压到E盘. 2.配置环境变量.新增ANT_HOME:E:\apache-ant-1.8.4:P ...
- ant脚本编写
使用ant脚本前的准备 1.下载一个ant安装包.如:apache-ant-1.8.4-bin.zip.解压到E盘. 2.配置环境变量.新增ANT_HOME:E:\apache-ant-1.8.4:P ...
- Ant 脚本打印系统属性变量、ant内置属性
Ant 脚本打印系统属性变量.ant内置属性 作用 编写ant脚本的时候,经常会引用到系统属性,本脚本用于打印系统常用属性(System.getProperties)与环境变量(Environment ...
- 关于项目既要使用ant脚本又要使用maven pom.xml文件的问题
背景:项目使用的是ant脚本打包,但又需要maven去执行sonar代码扫描.所以项目中既有build.xml又有pom.xml build.xml设置的打包后产物文件夹为target,maven运行 ...
- 通过ant脚本编译打包android工程
通过ant脚本,编译打包android工程 1.Android程序编译.打包.签名.发布的三种方式: 方式一:命令行手动编译打包 方式二:使用ant自动编译打包 方式三:使用eclipse+AD ...
- 转: Ant 脚本的结构化设计
引言 Ant 脚本是由 Apache 提供的一种基于 Java 的构建工具,为 Java 开发人员所熟悉.Java 开发人员使用 Ant 脚本可以很方便地完成 Java 开发过程中常见的如拷贝文件.创 ...
- ant脚本
jenkins在调用ant脚本时会遇到ant中的目标没有成功,但是最后的build状态却是success,如下图所示:代码中缺少一个},编译发生错误,最后的build成功. 解决方案:在关键的targ ...
随机推荐
- 9.java.lang.ClassCastException
java.lang.ClassCastException 数据类型转换异常 当试图将对某个对象强制执行向下转型,但该对象又不可转换又不可转换为其子类的实例时将引发该异常,如下列代码. Object o ...
- Python调用C/C++的种种方法
Python调用C/C++的种种方法 2010-12-07 09:59 28433人阅读 评论(1) 收藏 Python是解释性语言, 底层就是用c实现的, 所以用python调用C是很容易的, 下面 ...
- 文件转换dll mingw
MinGW:c -> o gcc -c a.cc -> exe gcc a.c libs.o -o a.exe (从主程序a.c,附加libs,生成a. ...
- Android手势源码浅析-----手势绘制(GestureOverlayView)
Android手势源码浅析-----手势绘制(GestureOverlayView)
- python 读取utf8文件
有时候默认是gbk编码,但是要读取utf8文件,所以会出现decode 错误. 使用codecs模块: import codecs file = codecs.open('filename','r', ...
- linux 查看信息命令
# uname -a # 查看内核/操作系统/CPU信息# head -n 1 /etc/issue # 查看操作系统版本# cat /proc/cpuinfo # 查看CPU信息# hostname ...
- 解决本地访问Android文档是非常慢的问题
不时在天上不能上网Android开发站点.要查看开发者文档,真是费劲心思,这里不再介绍访问Android开发网站developer.android.com,这里介绍怎样高速的訪问打开本地的SDK下An ...
- SQlSERVER生成唯一编号
基数表-用来存储编号前缀和类型 建表如下 CREATE TABLE [dbo].[SerialNo]( [sCode] [varchar](50) NOT NULL, [sName] [varchar ...
- JSONObject put accumulate element 方法区别-------java中
1.public Object put (Object key, Object value) 将value映射到key下.如果此JSONObject对象之前存在一个value在这个key下,当前的va ...
- JSTL入门
在页面最上方引入 -------------------- if语句 8}"> b的值大于8 --------------------- foreach语句 i的值是:${i}