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包把他们放在应该放置的地 ...
随机推荐
- EntityFramework更新多条数据【8万】
此文主要用做记录用: 原因:数据库迁移,需要转换大量用户资料,两数据某字段加密方式不一致需要批量转换 注:转换程序用了EntityFramework 过程: 1.读取所有需要转换数据至List 2.采 ...
- 集合框架Map之KeySet方法的使用
package cn.itcast.map; import java.util.HashMap; import java.util.Iterator; import java.util.Map; im ...
- Delphi给窗体镶边-为控件加边框,描边,改变边框颜色
PS:因为我现在用的电脑是WIN7 64位系统,所以没有实现功能,不知道XP是否可行. //1.定义方法 procedure WMNCPaint(var Msg : TWMNCPaint); mess ...
- 问题-WIN7 ..\Bin\InitCC32.exe".进程无法访问(拒绝访问)
问题现象: 问题原因:是InitCC32.exe没有权限. 问题处理:在DELPHI7的安装目录里设置用户权限,加入EVE... 这个用户.
- Bugs及解决方案列表
Bugs及解决方案列表(以下实例默认运行环境都为Standard mode): 如何在IE6及更早浏览器中定义小高度的容器? 方法: #test{overflow:hidden;height:1px; ...
- 【转】Javascript 面向对象编程(一):封装
原文链接:http://www.ruanyifeng.com/blog/2010/05/object-oriented_javascript_encapsulation.html Javascript ...
- 高性能javascript
高性能javascript开发 标签(空格分隔): javascript DOM访问与修改 访问DOM元素是具有代价的,修改元素代价较为昂贵,会导致浏览器重新计算页面的几何变化. 尽量减少DOM访问, ...
- MySQL索引使用方法和性能优化
在自己的一个项目中,数据比较多,搜索也很频繁,这里找到一个建立索引很不错的文章,推荐下. 关于MySQL索引的好处,如果正确合理设计并且使用索引的MySQL是一辆兰博基尼的话,那么没有设计和使用索引的 ...
- ThinkPHP中URL解析原理,以及URL路由使用教程!
几个概念: THINKPHP 是一个MVC框架,使用PATHINFO解析出分组名,模块名,方法名,以及参数. PATHINFO:就是 http://localhost/index.php/Home/I ...
- Redis实战之Redis + Jedis
用Memcached,对于缓存对象大小有要求,单个对象不得大于1MB,且不支持复杂的数据类型,譬如SET 等.基于这些限制,有必要考虑Redis! 相关链接: Redis实战 Redis实战之Redi ...