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 ...
随机推荐
- [原创]抢先DriverStudio夺取机器控制权(下篇)
原文链接:抢先DriverStudio夺取机器控制权(下篇) 上篇仅仅说到如何抢先DriverStudio,并在结尾留给大家一个遐想.现在我进一步拓展这个遐想,从而给大家更多的遐想.: ) 那么现在我 ...
- SSH Session Recorder
If you want to record your root ssh session create a file .bash_profile . and copy below line by l ...
- CC++初学者编程教程(3) 安装VS2010 boost标准库开发环境
1. BOOST编译过程非常复杂,目前为了学习BOOST,首先搭建基于VS2010的BOOST开发环境. Boost库 8 9. 10. 11 12 13 14 15. 16. 17. 18 ...
- GDKOI2015 Day2
P1 题目描述: 给出一个二分图,选择互不相交的边,使得边覆盖的点权和最大. solution: 简单DP,用树状数组维护最大值. 时间复杂度:$O(n \log n) $ P2 题目描述: 给出N个 ...
- Spring AOP AspectJ Pointcut 表达式例子
主要来源:http://howtodoinjava.com/spring/spring-aop/writing-spring-aop-aspectj-pointcut-expressions-with ...
- ZooKeeper源码阅读(二):客户端
源代码: http://svn.apache.org/repos/asf/zookeeper/trunk/ 导入eclipse: 在包含build.xml目录下执行ant eclipse将产生.cla ...
- C++ 清空消息队列
在button等被禁用后,可能须要它在禁用期间不去响应不论什么消息. 能够使用以下的语句片段: MSG msg; //消耗掉消息队列中的全部消息 while(::PeekMessage(&ms ...
- iOS-BLE蓝牙开发
Demo地址:WEBlueToothManager 在写这个博客之前,空余时间抽看了近一个月的文档和Demo,系统给的解释很详细,接口也比较实用,唯独有一点,对于设备 的唯一标示,网上众说纷纭,在这里 ...
- eclipse 中修改 M2_REPO的值
转自: http://blog.csdn.net/xuechongyang/article/details/8267440 从eclipse中增加了maven2的插件之后,maven默认的本地库的路径 ...
- openwrt看IP流量
可以利用iptable来实现的,看附件的脚本. 把他放到路由器里面,然后运行. #!/bin/sh echo "Collecting data..." echo "&qu ...