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 ...
随机推荐
- JS获取浏览器窗口大小 获取屏幕,浏览器,网页高度宽度
网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWid ...
- SQL Server 日志截断
截断事务日志是逻辑操作,只是把日志的一部分标记为‘不再需要’所以可以重用这个空间,截断不是物理操作,不会减少磁盘上文件的大小, 要减小物理大小必定要进行收缩. ----------- 有时就算是备份都 ...
- Oracle单个数据文件超过32G后扩容
Oracle单个数据文件超过32G后扩容 表空间数据文件容量与DB_BLOCK_SIZE的设置有关,而这个参数在创建数据库实例的时候就已经指定.DB_BLOCK_SIZE参数可以设置为4K.8K. ...
- 不能取组织ID
应用 Oracle Purchasing 层 Level Function 函数名 Funcgtion Name PO_POXBWVRP 表单名 Form Name POXBWVRP 说明 Des ...
- HDU 5811 Colosseo(拓扑排序+单调DP)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5811 [题目大意] 给出 一张单向图,现在将其划分成了两个部分,问划分之后的点是否分别满足按照一定 ...
- css首行缩进两个字符串
text-indent:2em; 这个属性就可以缩进,但是2em不确定是什么意思:抽空总结一下
- 07.19 Linux命令 cd
情景:在用compass编写sass,cd进入目录后,想退出, 解决: cd.. 回到上一层目录 cd\ 回到根目录 cd 进入具体目录
- Android解析XML
在Android平台上可以使用Simple API for XML(SAX) . Document Object Model(DOM)和Android附带的pull解析器解析XML文件. 下面是本例子 ...
- c++打印环境变量
直接上代码:cpp版本 #include <stdio.h> #include <stdlib.h> #include <string.h> extern char ...
- asp.net 使用my97 datepicker实现前后两个日期的范围界定
说明:日期选择后,前面的日期小于等后面的日期,后面的日期大于等于前面的日期.点点看就知道了:) - 这里将周末日期不可选.代码如下: <html xmlns="http://www.w ...