通用模块common.xml build.xml

<?xml version="1.0" encoding="utf-8"?>
<project>
<property name="build.dir" value="dest"/>
<property name="src.dir" value="src"/>
<property name="etc.dir" value="etc"/>
<property name="lib.dir" value="../appdemo/lib"/>
<property name="buildlib.dir" value="../appdemo/buildlib"/>
<property name="web.dir" value="web"/>
<property environment="env"/>
<property name="tomcat.home" value="${env.Tomcat_home}"/>

<path id="classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/common/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${build.dir}/classes"/>
</path>
<path id="buildclasspath">
<path refid="classpath"/>
<fileset dir="${buildlib.dir}">
<include name="*.jar"/>
</fileset>
</path>

<!--==========================================================-->
<!--==The help target is used to display the helping message==-->
<!--==========================================================-->
<target name="help">
<echo message=""/>
<echo message="${webapp.name} build file"/>
<echo message="===================================="/>
<echo message=""/>
<echo message="Available targets are:"/>
<echo message=""/>
<echo message="help --> Print this screen"/>
<echo message="compile --> Compile all Java files"/>
</target>
<!--==========================================================-->
<!--==The Compile target is used to compile project and copy==-->
<!--==Hibernate configuration file to the proper direction. ==-->
<!--==========================================================-->
<target name="compile" description="compile the java source and copy the configuration file">
<mkdir dir="${build.dir}/classes"/>
<javac destdir="${build.dir}/classes" target="1.5" source="1.5" debug="true" deprecation="true" optimize="false" failοnerrοr="true">
<src path="${src.dir}"/>
<classpath refid="classpath"/>
</javac>
<!-- copy hibernate mapping files to ${build.dir}/classes-->
<copy todir="${build.dir}/classes">
<fileset dir="${src.dir}" includes="**/*.hbm.xml"/>
</copy>
<copy todir="${src.dir}/classes">
<fileset todir="${etc.dir}/classes" includes="**/*.xml"/>
<fileset todir="${etc.dir}/classes" includes="**/*.properties">
<exclude name="**/*_zh.properties"/>
</fileset>
</copy>

<native2ascii dest="${build.dir}/classes" encoding="utf-8"
src="${etc.dir}/classes" includes="**/*_zh.properties"></native2ascii>
</target>
<!--==========================================================-->
<!--==The deploy target is used to deploy project and copy ==-->
<!--==the configuration file to the tomcat container ==-->
<!--==========================================================-->
<target name="deploy" depends="compile" description="deploy the project to the tomcat">
<!--copy the web file-->
<copy todir="${tomcat.home}/webapps/${webapp.name}" preservelastmodified="true">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
<exclude name="**/readme.txt"/>
</fileset>
</copy>
<!--copy the classes file-->
<copy todir="${tomcat.home}/webapps/${webapp.name}/WEB-INF/classes" preservelastmodified="true">
<fileset dir="${build.dir}/classes">
</fileset>
</copy>
<!--copy the lib file-->
<copy todir="${tomcat.home}/webapps/${webapp.name}/WEB-INF/lib" preservelastmodified="true">
<fileset dir="${lib.dir}">
<exclude name="**/readme.txt"/>
</fileset>
</copy>
<!--copy the configuration file-->
<copy todir="${tomcat.home}/webapps/${webapp.name}/WEB-INF" preservelastmodified="true">
<fileset dir="${etc.dir}">
<exclude name="**/readme.txt"/>
</fileset>
</copy>
</target>
<!--==========================================================-->
<!--==The clean target is used to clean output directories ==-->
<!--==========================================================-->
<target name="clean" description="Clean output directories">
<delete dir="${build.dir}"/>
<delete dir="${tomcat.home}/webapps/${webapp.name}"/>
</target>
<!--==========================================================-->
<!--==The new target is used to create a new project by========-->
<!--== duplicationg this project and replacing "message" instances with the new name-->
<!--==========================================================-->
<target name="new" description="creates a new project with the specified name">
<echo level="info">
+------------------------------------------------------------+
| ---Welcome to the AppDemo New Application Wizard!-- |
| |
| To create a new application ,please answer the following |
| question. |
+------------------------------------------------------------+

</echo>
<echo/>
<!--Prompt user for input-->
<input message="What would you like to name your application{myapp}?" addproperty="app.name" defaultvalue="myapp"/>
<echo level="info">Creating new application named "${app.name}".. </echo>
<copy todir="../${app.name}">
<fileset dir="${basedir}">
<exclude name="**/*.jar"/>
<exclude name="common.xml"/>
</fileset>
</copy>
<!--replace app name-->
<replaceregexp flags="g">
<regexp pattern="message"/>
<substitution expression="${app.name}"/>
<fileset dir="../${app.name}">
<include name="**"/>
<exclude name="**/*.jar"/>
</fileset>
</replaceregexp>
</target>
<!--==========================================================-->
<!--==The "test" target is used to execute the unit test by junit-->
<!--==========================================================-->
<target name="test" description="Run junit test.">
<junit printsummary="true">
<formatter type="xml"/>
<test name="cn.hxex.message.test.AllTests"/>
<classpath refid="classpath"/>
</junit>
<junitreport todir="${build.dir}/test">
<fileset dir=".">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes" todir="${build.dir}/report"/>
</junitreport>
</target>
</project>


<?xml version="1.0" encoding="utf-8"?>
<project name="appdemo" basedir="." default="help">
<property name="webapp.name" value="appdemo"/>
<import file="../appdemo/common.xml"/>
</project>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值