ant+dbunit 导xml到mysql
1.增加自己的data目录和xml数据文件
2.lib依赖
- commons-logging-1.1.1.jar
- dbunit-2.4.8.jar
- junit-4.9b2.jar
- mysql-connector-java-3.1.12-bin.jar
- slf4j-api-1.6.1.jar
- slf4j-jcl-1.6.1.jar
3.ant文件如上
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <project name="project" default="" basedir=".">
4
5 <property name="lib" value="lib" />
6 <property name="conf" value="conf" />
7 <property name="dbunit.operation.type" value="REFRESH" />
8 <!--CLEAN_INSERT,REFRESH-->
9
10 <property environment="env" />
11
12 <!--本地环境-->
13 <property file="${conf}/application.properties" />
14
15 <!--linux环境-->
16 <property file="${env.TX_CONF_PATH}/application.properties" />
17
18 <path id="lib.path">
19 <pathelement location="${conf}"/>
20 <fileset dir="${lib}">
21 <include name="**/*.jar" />
22 </fileset>
23 </path>
24
25 <!-- load init data -->
26 <target name="load" description="load test data into db">
27 <echo message="更新数据库中的策划配数数据 到 ${env.TX_CONF_PATH}" />
28 <taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="lib.path">
29 </taskdef>
30 <!--REFRESH CLEAN_INSERT-->
31 <dbunit driver="com.mysql.jdbc.Driver" url="jdbc:mysql://${mysql.dbServer}?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true" userid="${mysql.user}" password="${mysql.passwd}" supportBatchStatement="true" >
32 <!-- type可选择的方式 删除、清空插入、追加 UPDATE, INSERT, REFRESH, DELETE, DELETE_ALL, CLEAN_INSERT-->
33 <operation type="${dbunit.operation.type}" src="data/Entity.xml" />
34 <operation type="${dbunit.operation.type}" src="data/EntityConsume.xml" />
35 <operation type="${dbunit.operation.type}" src="data/EntityLimit.xml" />
36 <operation type="${dbunit.operation.type}" src="data/Effect.xml" />
37 <operation type="${dbunit.operation.type}" src="data/SysPara.xml" />
38 <operation type="${dbunit.operation.type}" src="data/DropPack.xml" />
39 <operation type="${dbunit.operation.type}" src="data/Item.xml" />
40 <operation type="${dbunit.operation.type}" src="data/Equip.xml" />
41 <operation type="${dbunit.operation.type}" src="data/Army.xml" />
42
43 </dbunit>
44 </target>
45 </project>
4. 运行结果
Buildfile: E:\heart\workspace\RedAlert_v0.1\build.xml
load:
[echo] 更新数据库中的策划配数数据 到 ${env.TX_CONF_PATH}
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Entity.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\EntityConsume.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\EntityLimit.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Effect.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\SysPara.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\DropPack.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Item.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Equip.xml
[dbunit] with format: null
[dbunit] Executing operation: REFRESH
[dbunit] on file: E:\heart\workspace\RedAlert_v0.1\data\Army.xml
[dbunit] with format: null
BUILD SUCCESSFUL
Total time: 25 seconds
ant+dbunit 导xml到mysql的更多相关文章
- Ant 之bulid.xml详解
ANT build.xml文件详解(一) Ant的概念 可能有些读者并不连接什么是Ant以及入可使用它,但只要使用通过Linux系统得读者,应该知道 make这个命令.当编译Linux内核及一些软件的 ...
- Eclipse 自动生成 Ant的Build.xml 配置文件
Eclipse 自动生成 Ant的Build.xml 配置文件,生成的方法很隐蔽 选择你要生成Build.xml文件的项目,右键. Export-> General -> Ant Buil ...
- Ant之build.xml详解
Ant之build.xml详解 关键字: ant build.xml Ant的概念 可能有些读者并不连接什么是Ant以及入可使用它,但只要使用通过Linux系统得读者,应该知道make这个命令.当编译 ...
- 【转】Ant之build.xml详解
关键字: ant build.xml Ant的概念 可能有些读者并不连接什么是Ant以及入可使用它,但只要使用通过Linux系统得读者,应该知道make这个命令.当编译Linux内核及一些软件的源程序 ...
- Ant运行build.xml执行服务器scp,异常解决jsch.jar
公司ant打包上线 一直出现这个问题. Ant运行build.xml执行服务器scp,异常解决jsch.jar BUILD FAILEDD:\eclipse\eclipse-jee-luna-SR2- ...
- Ant之build.xml详解---可用
Ant的概念 :在Eclipse中使用Ant Ant是Java平台下非常棒的批处理命令执行程序,能非常方便地自动完成编译,测试,打包,部署等等一系列任务,大大提高开发效率. Ant和make命令很像. ...
- 使用ant build build.xml报“includeantruntime was not set”警告及"Class not found: javac1.8"问题
问题1:ant编译build.xml报“includeantruntime was not set”警告. 警告详情: warning: 'includeantruntime' was not set ...
- Ant:build.xml 结构
Ant build.xml 结构 project target task data property datatype v\:* {behavior:url(#default#VML);} o\:* ...
- ANT编译build.xml
一,体验ant就像每个语言都有HelloWorld一样,一个最简单的应用能让人感受一下Ant1,首先你要知道你要干什么,我现在想做的事情是:编写一些程序编译它们把它打包成jar包把他们放在应该放置的地 ...
随机推荐
- 【转】linux trap
在有些情况下,我们不希望自己的shell脚本在运行时刻被中断,比如说我们写得shell脚 本设为某一用户的默认shell,使这一用户进入系统后只能作某一项工作,如数据库备份, 我 们可不希望用户使用c ...
- HDU-4635 Strongly connected 强连通,缩点
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4635 题意:给一个简单有向图(无重边,无自环),要你加最多的边,使得图还是简单有向图... 先判断图是 ...
- Android实例-利用WebBrowser实现浏览器(XE8+小米2)
结果: 1.网络好的情况下,打开很快,很流畅. 2.地址栏真心不好使,如果真要做应用,这块必须自己优化一下. 实例代码: unit Unit1; interface uses System.SysUt ...
- jQuery语法总结及注意事项
1.关于页面元素的引用通过jquery的$()引用元素包括通过id.class.元素名以及元素的层级关系及dom或者xpath条件等方法,且返回的对象为jquery对象(集合对象),不能直接调用dom ...
- android http 通信(java原生类库实现)
get方式 private void doGet(){ URL httpurl = new URl(url); HttpURLConnection conn = (HttpURLConnection) ...
- wavecom短信猫常用AT命令
wavecom短信猫常用AT命令 一.一般命令 1. AT+CGMI 给出模块厂商的标识. 2. AT+CGMM 获得模块标识.这个命令用来得到支持的频带 (GSM 900,DCS 1800 或PCS ...
- 【C++深入浅出】设计模式学习之单例模式
但凡成为大家公认的模式,都是有一些不可小觑的威力,今天分享一个简单的设计模式:单例模式. 单例模式用于一些只希望有一个实例的类或者只希望执行一次的操作:校长只能有一个.老板只能有一个.用户点击弹窗只希 ...
- 10个Visual Studio原生开发调试技巧
10个Visual Studio原生开发调试技巧(1) 2013-05-29 13:30 佚名 开源中国 我要评论(1) 字号:T | T 以下的列表中你可以看到写原生开发的调试技巧(接着以前的文章来 ...
- (10.09作业)学生选课数据库SQL语句练习题
- 手把手教你去ECSHOP版权 powered by ecshop
各位朋友大家好,欢迎来到ecshop开发中心系列视频教程:ecshop去版权.去版权是一种很常见的问题,有很多客户提到ECSHOP如何去版权?怎样去得干净.去得彻底?今天,ECSHOP开发中心手把 ...