Ant build.xml sample
来源:互联网 发布:逻辑回归算法知乎 编辑:程序博客网 时间:2024/05/16 07:39
[ the bug in my project is that one fileld name in database table is "e-mail" which makes trouble. (can change to to e_mail) In the mean time, it is better not use key word like "class" as field name. I remeber that it makes hibernate some trouble. And in my case of ant target "data_inital", "&sessionVariables=FOREIGN_KEY_CHECKS=0" and "transaction='true' " is required by foreign key constrains ]
build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="test_all" name="AdSystem">
<property file="build.properties"/>
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.5"/>
<property name="source" value="1.5"/>
<path id="Java EE 5 Libraries.libraryclasspath">
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/javaee.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/jsf-impl.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/jsf-api.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/jstl-1.2.jar"/>
</path>
<path id="JUnit 4.libraryclasspath">
<pathelement location="${ECLIPSE_HOME}/plugins/org.junit4_4.3.1/junit.jar"/>
</path>
<path id="AdSystem.classpath">
<pathelement location="WebRoot/WEB-INF/classes"/>
<path refid="Java EE 5 Libraries.libraryclasspath"/>
<pathelement location="WebRoot/WEB-INF/lib/commons-logging-1.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/freemarker-2.3.8.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/ognl-2.6.11.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/struts2-core-2.0.6.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/xwork-2.0.4.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/antlr-2.7.6rc1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/asm-attrs.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/asm.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/cglib-2.1.3.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/commons-collections-2.1.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/commons-logging-1.0.4.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/ehcache-1.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/hibernate3.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jaas.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jaxen-1.1-beta-7.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jdbc2_0-stdext.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jta.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/log4j-1.2.11.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/xerces-2.6.2.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/xml-apis.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/mysql-connector-java-3.1-nightly-20051207-bin.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/spring.jar"/>
<path refid="JUnit 4.libraryclasspath"/>
</path>
<taskdef resource="checkstyletask.properties"
classpath="lib/checkstyle/checkstyle-all-4.4.jar"/>
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpath="lib/dbunit/dbunit-2.2.jar"/>
<target name="clean">
<delete dir="WebRoot/WEB-INF/classes"/>
</target>
<target name="build" depends="clean">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="WebRoot/WEB-INF/classes" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="AdSystem.classpath"/>
</javac>
<javac debug="true" debuglevel="${debuglevel}" destdir="WebRoot/WEB-INF/classes" source="${source}" target="${target}">
<src path="test_src"/>
<classpath refid="AdSystem.classpath"/>
</javac>
</target>
<!-- -->
<target name="data_inital">
<dbunit driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/newad?useUnicode=true&characterEncoding=utf-8&sessionVariables=FOREIGN_KEY_CHECKS=0"
userid="root"
password="root">
<classpath refid="AdSystem.classpath"/>
<operation type="CLEAN_INSERT" src="lib/dbunit/data_inital.xml" transaction="true"/>
</dbunit>
</target>
<target name="data_export">
<dbunit driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/newad?useUnicode=true&characterEncoding=utf-8"
userid="root"
password="root">
<classpath refid="AdSystem.classpath"/>
<export dest="lib/dbunit/export.xml"/>
</dbunit>
</target>
<target name="test">
<junit>
<classpath refid="AdSystem.classpath" />
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="${MY_TEST_DIRECTORY}">
<include name="**/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="checkstyle">
<checkstyle config="lib/checkstyle/cgogo_check.xml" classpath="lib/checkstyle/checkstyle-all-4.4.jar">
<fileset dir="${MY_CHECK_DIRECTORY}" includes="**/*.java" excludes="dao.model/*.*"/>
</checkstyle>
</target>
<target name="test_all">
<junit>
<classpath refid="AdSystem.classpath" />
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="test_src">
<include name="**/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="checkstyle_all">
<checkstyle config="lib/checkstyle/cgogo_check.xml" classpath="lib/checkstyle/checkstyle-all-4.4.jar">
<fileset dir="src" includes="**/*.java" excludes="dao/model/**/*.java"/>
</checkstyle>
</target>
<target name="all" depends="build, test_all, checkstyle_all" />
</project>
<project basedir="." default="test_all" name="AdSystem">
<property file="build.properties"/>
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.5"/>
<property name="source" value="1.5"/>
<path id="Java EE 5 Libraries.libraryclasspath">
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/javaee.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/jsf-impl.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/jsf-api.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820/data/libraryset/EE_5/jstl-1.2.jar"/>
</path>
<path id="JUnit 4.libraryclasspath">
<pathelement location="${ECLIPSE_HOME}/plugins/org.junit4_4.3.1/junit.jar"/>
</path>
<path id="AdSystem.classpath">
<pathelement location="WebRoot/WEB-INF/classes"/>
<path refid="Java EE 5 Libraries.libraryclasspath"/>
<pathelement location="WebRoot/WEB-INF/lib/commons-logging-1.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/freemarker-2.3.8.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/ognl-2.6.11.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/struts2-core-2.0.6.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/xwork-2.0.4.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/antlr-2.7.6rc1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/asm-attrs.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/asm.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/cglib-2.1.3.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/commons-collections-2.1.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/commons-logging-1.0.4.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/ehcache-1.1.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/hibernate3.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jaas.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jaxen-1.1-beta-7.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jdbc2_0-stdext.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/jta.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/log4j-1.2.11.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/xerces-2.6.2.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/xml-apis.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/mysql-connector-java-3.1-nightly-20051207-bin.jar"/>
<pathelement location="WebRoot/WEB-INF/lib/spring.jar"/>
<path refid="JUnit 4.libraryclasspath"/>
</path>
<taskdef resource="checkstyletask.properties"
classpath="lib/checkstyle/checkstyle-all-4.4.jar"/>
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpath="lib/dbunit/dbunit-2.2.jar"/>
<target name="clean">
<delete dir="WebRoot/WEB-INF/classes"/>
</target>
<target name="build" depends="clean">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="WebRoot/WEB-INF/classes" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="AdSystem.classpath"/>
</javac>
<javac debug="true" debuglevel="${debuglevel}" destdir="WebRoot/WEB-INF/classes" source="${source}" target="${target}">
<src path="test_src"/>
<classpath refid="AdSystem.classpath"/>
</javac>
</target>
<!-- -->
<target name="data_inital">
<dbunit driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/newad?useUnicode=true&characterEncoding=utf-8&sessionVariables=FOREIGN_KEY_CHECKS=0"
userid="root"
password="root">
<classpath refid="AdSystem.classpath"/>
<operation type="CLEAN_INSERT" src="lib/dbunit/data_inital.xml" transaction="true"/>
</dbunit>
</target>
<target name="data_export">
<dbunit driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/newad?useUnicode=true&characterEncoding=utf-8"
userid="root"
password="root">
<classpath refid="AdSystem.classpath"/>
<export dest="lib/dbunit/export.xml"/>
</dbunit>
</target>
<target name="test">
<junit>
<classpath refid="AdSystem.classpath" />
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="${MY_TEST_DIRECTORY}">
<include name="**/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="checkstyle">
<checkstyle config="lib/checkstyle/cgogo_check.xml" classpath="lib/checkstyle/checkstyle-all-4.4.jar">
<fileset dir="${MY_CHECK_DIRECTORY}" includes="**/*.java" excludes="dao.model/*.*"/>
</checkstyle>
</target>
<target name="test_all">
<junit>
<classpath refid="AdSystem.classpath" />
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="test_src">
<include name="**/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="checkstyle_all">
<checkstyle config="lib/checkstyle/cgogo_check.xml" classpath="lib/checkstyle/checkstyle-all-4.4.jar">
<fileset dir="src" includes="**/*.java" excludes="dao/model/**/*.java"/>
</checkstyle>
</target>
<target name="all" depends="build, test_all, checkstyle_all" />
</project>
build.properties
ECLIPSE_HOME=D:/Program Files/MyEclipse 6.0/eclipse
MY_TEST_DIRECTORY=test_src/dao
MY_CHECK_DIRECTORY=src/helper
MY_TEST_DIRECTORY=test_src/dao
MY_CHECK_DIRECTORY=src/helper
cgogo_check.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
<module name="Checker">
<module name="TreeWalker">
<!--
<module name="RegexpHeader">
<property name="headerFile"
value="lib/checkstyle/java_head.txt" />
<property name="multiLines" value="11" />
</module>
-->
<module name="PackageName">
<property name="format" value="^[a-z]+(.[a-z][a-z0-9]*)*$" />
</module>
<module name="RedundantImport"/>
<!-- 检查作者注释 @author -->
<module name="JavadocType">
<property name="authorFormat" value="S" />
</module>
<!-- 检查产生日期注释 @since -->
<module name="WriteTag">
<property name="tag" value="@since"/>
<property name="severity" value="error"/>
</module>
<!-- 方法长度 50 -->
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF" />
<property name="max" value="50" />
</module>
<!-- 内部类最大20行 -->
<module name="AnonInnerLength">
<property name="max" value="20" />
</module>
<!--System.out.print 输出 -->
<module name="GenericIllegalRegexp">
<property name="format" value="System.out.print" />
<property name="message"
value="bad practice of use System.out.print" />
</module>
</module>
</module>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
<module name="Checker">
<module name="TreeWalker">
<!--
<module name="RegexpHeader">
<property name="headerFile"
value="lib/checkstyle/java_head.txt" />
<property name="multiLines" value="11" />
</module>
-->
<module name="PackageName">
<property name="format" value="^[a-z]+(.[a-z][a-z0-9]*)*$" />
</module>
<module name="RedundantImport"/>
<!-- 检查作者注释 @author -->
<module name="JavadocType">
<property name="authorFormat" value="S" />
</module>
<!-- 检查产生日期注释 @since -->
<module name="WriteTag">
<property name="tag" value="@since"/>
<property name="severity" value="error"/>
</module>
<!-- 方法长度 50 -->
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF" />
<property name="max" value="50" />
</module>
<!-- 内部类最大20行 -->
<module name="AnonInnerLength">
<property name="max" value="20" />
</module>
<!--System.out.print 输出 -->
<module name="GenericIllegalRegexp">
<property name="format" value="System.out.print" />
<property name="message"
value="bad practice of use System.out.print" />
</module>
</module>
</module>
- Ant build.xml sample
- build.xml sample for ant
- ANT Build.xml例子
- Apache Ant Build.xml
- ANT-build.xml详解
- ant & build.xml详解
- ant build.xml
- ANT Build.xml例子
- ANT build.xml详解
- Ant build.xml
- ant build.xml study
- Ant 入门 Build.xml
- Ant build.xml 模板
- Ant配置文件build.xml
- ANT-Build.xml
- MyEclipse Ant build.xml
- ant-build.xml说明- -
- Ant build.xml 模版
- CakePHP中文教程5
- waitpid
- package从实践到理论
- CakePHP中文教程6
- C/C++语言void及void指针深层探索
- Ant build.xml sample
- prototype.js常用函数及其用法
- 转载:解析商业智能失败的根源
- c#用word打印
- 第二章 深入探讨控制反转(Ioc)和依赖注入(DI)
- 在BREW中打造自己的GUI(7)-动态效果的实现
- Double.valueOf 与 parseDouble 的区别
- VC数字图像处理编程讲座之五(转)
- VC进程间通信之消息传递