<?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脚本实践的更多相关文章

  1. 利用ant脚本 自动构建svn增量/全量 系统程序升级包

    首先请允许我这样说,作为开发或测试,你一定要具备这种 本领.你可以手动打包.部署你的工程,但这不是最好的方法.最好的方式就是全自动化的方式.开发人员提交了代码后,可以自动构建.打包.部署到测试环境. ...

  2. [自动运维]ant脚本打包,上传文件到指定服务器,并部署

    1.根节点使用,表示根目录为当前目录,默认启动的target为build,项目名称为othersysm, <project basedir="." default=" ...

  3. 利用Ant脚本生成war包的详细步骤

    使用ant脚本前的准备 1.下载一个ant安装包.如:apache-ant-1.8.4-bin.zip.解压到E盘. 2.配置环境变量.新增ANT_HOME:E:\apache-ant-1.8.4:P ...

  4. ant脚本编写

    使用ant脚本前的准备 1.下载一个ant安装包.如:apache-ant-1.8.4-bin.zip.解压到E盘. 2.配置环境变量.新增ANT_HOME:E:\apache-ant-1.8.4:P ...

  5. Ant 脚本打印系统属性变量、ant内置属性

    Ant 脚本打印系统属性变量.ant内置属性 作用 编写ant脚本的时候,经常会引用到系统属性,本脚本用于打印系统常用属性(System.getProperties)与环境变量(Environment ...

  6. 关于项目既要使用ant脚本又要使用maven pom.xml文件的问题

    背景:项目使用的是ant脚本打包,但又需要maven去执行sonar代码扫描.所以项目中既有build.xml又有pom.xml build.xml设置的打包后产物文件夹为target,maven运行 ...

  7. 通过ant脚本编译打包android工程

    通过ant脚本,编译打包android工程 1.Android程序编译.打包.签名.发布的三种方式:  方式一:命令行手动编译打包  方式二:使用ant自动编译打包  方式三:使用eclipse+AD ...

  8. 转: Ant 脚本的结构化设计

    引言 Ant 脚本是由 Apache 提供的一种基于 Java 的构建工具,为 Java 开发人员所熟悉.Java 开发人员使用 Ant 脚本可以很方便地完成 Java 开发过程中常见的如拷贝文件.创 ...

  9. ant脚本

    jenkins在调用ant脚本时会遇到ant中的目标没有成功,但是最后的build状态却是success,如下图所示:代码中缺少一个},编译发生错误,最后的build成功. 解决方案:在关键的targ ...

随机推荐

  1. 函数指针 如:void (*oper)(ChainBinTreee *p)

    在C语言中,一个函数总是占用一段连续的内存区,而函数名就是该函数所占内存区的首地址.我们可以把函数的这个首地址(或称入口地址)赋予一个指针变量,使该指针变量指向该函数.然后通过指针变量就可以找到并调用 ...

  2. 修改spinner选中以后显示的字体颜色

    原来spinner选中以后显示的view  还是textview  ,这样就是可以设置它的字体颜色了 sp.setOnItemSelectedListener(new OnItemSelectedLi ...

  3. Android_Intent意图详解

    本博文为子墨原创,转载请注明出处! http://blog.csdn.net/zimo2013/article/details/11863857 1.Intent作用 Intent是一个将要执行的动作 ...

  4. 愤怒的DZY(二分)

    愤怒的DZY[问题描述]“愤怒的小鸟”如今已经是家喻户晓的游戏了,机智的WJC最近发明了一个类似的新游戏:“愤怒的DZY”.游戏是这样的:玩家有K个DZY,和N个位于不同的整数位置:X1,X2,…,X ...

  5. Python操作Access数据库

    我们在这篇文章中公分了五个步骤详细分析了Python操作Access数据库的相关方法,希望可以给又需要的朋友们带来一些帮助. AD: Python编 程语言的出现,带给开发人员非常大的好处.我们可以利 ...

  6. 一步一步学c#(四):继承

    继承 1·继承的类型 在面向对象的编程中,有两种截然不同的继承类型,实现继承和接口继承. 实现继承:表示一个类型派生于一个基类型,它拥有该基类型的所有成员字段和函数. 接口继承:表示一个类型只继承了函 ...

  7. 简单C#文字转语音

    跟着微软走妥妥的,C#文字转语音有很多参数我就不说了,毕竟我也是初学者.跟大家分享最简单的方法,要好的效果得自己琢磨喽: 先添加引用System.Speech程序集: using System; us ...

  8. SQL学习之使用常用函数处理数据

    一.在介绍使用函数处理数据前,先说下使用DBMS(数据库管理系统)处理数据所带来的问题! 1.与几乎所有的DBMS都同等的支持SQL语句(如SELECT)不同,每一个DBMS都有特定的函数,事实上,只 ...

  9. Android UI高级交互设计Demo

    首先:是google的新标准 Google Material design 开源项目 1.直接拿来用!十大Material Design开源项目 2.收集android上开源的酷炫的交互动画和视觉效果 ...

  10. 表A中有两个表示时间的字段A,B;如果B的值大于A的值,则把B的值更新为A的值

    sql语句:表A中有两个表示时间的字段A,B:如果B的值大于A的值,则把B的值更新为A的值 update 表名 set B=A where B>A