Ant多项功能配置

 以下是Ant对多项应用的配置:

<?xml version="1.0" encoding="UTF-8"?>
<project name="GP Test" default="" basedir=".">
 <property file="build.properties"/>
 <property name="compile.debug" value="true"/>
 <property name="compile.deprecation" value="false"/>
 <property name="compile.optimize" value="true"/>
 
 <path id="compile.classpath">
  <pathelement location="${lib.home}"/>
  <fileset dir="${lib.home}">
   <include name="**/*.jar"/>
  </fileset>
 </path>
 
 <target name="clean" description="Clean the deploy dist.">
  <delete dir="${classes.home}"/>
  <delete dir="${tomcat.webapps}/${project.name}"/>
 </target>
 
 <target name="compile" description="Compile the java source.">
  <mkdir dir="${classes.home}"/>
  <javac srcdir="${src.home}"
   destdir="${classes.home}"
   debug="${compile.debug}"
   deprecation="${compile.deprecation}"
   optimize="${compile.optimize}"
  >
   <classpath refid="compile.classpath"/>
  </javac>
  
  <copy todir="${classes.home}">
   <fileset dir="${src.home}" excludes="*.properties"/>
   <fileset dir="${src.home}" excludes="*.xml"/>
   <fileset dir="${src.home}" excludes="**/*.java"/>
  </copy>
 </target>
 
 <target name="deploy" depends="compile"
   description="Deploy application to servlet container">

     <!-- Copy the contents of the build directory -->
     <mkdir     dir="${tomcat.webapps}/${project.name}"/>
  <mkdir     dir="${tomcat.webapps}/${project.name}/log"/>
  <mkdir     dir="${tomcat.webapps}/${project.name}/WEB-INF/reports"/>
     <mkdir     dir="${tomcat.webapps}/${project.name}/WEB-INF/classes"/>
     <mkdir     dir="${tomcat.webapps}/${project.name}/WEB-INF/lib"/>
    
     <copy    todir="${tomcat.webapps}/${project.name}/WEB-INF">
       <fileset dir="${webroot.webhome}/WEB-INF" includes="*.xml"/>
       <fileset dir="${webroot.webhome}/WEB-INF" includes="*.properties"/>
       <fileset dir="${webroot.webhome}/WEB-INF" includes="*.tld"/>
       <fileset dir="${webroot.webhome}/WEB-INF" includes="*.wsdd"/>
       <fileset dir="${webroot.webhome}/WEB-INF" includes="*.dtd"/>
       <!--fileset dir="${config.home}/properties" includes="*.*"/ -->
       <fileset dir="${src.home}" includes="*.properties"/>
       <fileset dir="${src.home}" includes="*.xml"/>
     </copy>
  
  <copy todir="${tomcat.webapps}/${project.name}">
   <fileset dir="${webroot.webhome}" includes="**/*.jsp"/>
   <fileset dir="${webroot.webhome}" includes="**/*.js"/>
   <fileset dir="${webroot.webhome}" includes="**/*.css"/>
   <fileset dir="${webroot.webhome}" includes="**/*.gif"/>
  </copy>
  
  <copy todir="${tomcat.webapps}/${project.name}/WEb-INF/reports">
   <fileset dir="${reports.home}" includes="*.*"/>
  </copy>
        
     <copy    todir="${tomcat.webapps}/${project.name}/WEB-INF/classes">
        <fileset dir="${classes.home}" excludes="**/*.properties"/>
      <fileset dir="${classes.home}" excludes="**/*.xml"/>
     </copy>
    
    <copy    todir="${tomcat.webapps}/${project.name}/WEB-INF/lib">
     <fileset dir="${lib.home}" excludes="postgresql-8.0-311.jdbc3.jar"/>  
    </copy>
   </target>
 <!--Hibernate配置-->
 <target name="codegen" description="Generate Java source code from the Hibernate mapping files">                    
     <taskdef name="hibernatetool"
         classname="org.hibernate.tool.ant.HibernateToolTask"
         classpathref="compile.classpath"/>
     <hibernatetool destdir="${src.home}">
         <configuration propertyFile="build.properties">
             <fileset dir="${hibernate.mapping.home}">
               <include name="${hibernate.mapping.file}"/>
             </fileset>
         </configuration>
         <hbm2java />
     </hibernatetool>
 </target>
 
 <target name="hibernateCreator" description="Generate java source code and mapping files from the config file">
  <taskdef name="hibernatetool"
   classname="org.hibernate.tool.ant.HibernateToolTask"
  classpathref="compile.classpath"/>
  <hibernatetool destdir="${src.home}" classpath="${lib.home}" taskname="hibernatetool">
   <jdbcconfiguration configurationfile="${config.home}/hibernate.hbm.xml"
    revengfile="${config.home}/hibernate.reveng.xml"
    packagename="com.technodex.gp.hbm"/>
   <!--cfg2cfgxml/-->
   <cfg2hbm/>
   <hbm2java/>
   <hbm2ddl/>
   <hbm2doc/>
  </hibernatetool>
 </target>
 <!--Axis配置-->
 <target name="axisDeploy" description="Deploy axis service" depends="compile">
  <echo message="**/*Deploy the axis service..."/>
  <java classname="org.apache.axis.utils.Admin"
   failοnerrοr="true"
   fork="true"
   classpathref="compile.classpath"
   dir="${webroot.webhome}/WEB-INF/">
   <arg value="server"/>
   <arg file="${webservice.wsdd.path}"/>
  </java>
 </target>
 
 <taskdef resource="axis-tasks.properties" classpathref="compile.classpath"/>
 
 <target name="javaToWsdl" description="Create the wsdl file from the java class" depends="compile">
  <echo level="info" message="**/*Create the wsdl file..."/>
  <axis-java2wsdl classname="${webservice.java.class}"
   classpath="${classes.home}"
   classpathref="compile.classpath"
   location="${webservice.wsdl.location}"
   namespace="urn:com.technodex.gp.webservice"
   output="${schema.home}/${webservice.wsdl.file.name}"
   serviceelementname="${webservice.wsdl.service.name}"
   serviceportname="${webservice.wsdl.service.port.name}"
   style="rpc"
   use="encoded"
  />
 </target>
 
 <target name="wsdlToJava" description="Create the java class from wsdl file">
  <echo level="debug" message="**/*Create the java classes..."/>
  <axis-wsdl2java allowinvalidurl="on"
   debug="true"
   failonnetworkerrors="true"
   output="${webservice.java.class.output}"
   printstacktraceonfailure="true"
   timeout="30"
   testcase="true"
   verbose="true"
   url="${webservice.wsdl.file.url}">
   <mapping namespace="http://axis.apache.org/ns/interop" package="com.technodex.gp.webservice.client"/>
  </axis-wsdl2java>
 </target>
 <!--JasperReport配置-->
 <target name="jasperReportsCompile" description="Compile the jasperreports source files">
  <echo level="info" message="**/*Compile the jasperreports files..."/>
  <taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask">
   <classpath>
    <fileset dir="${lib.home}">
     <include name="*.jar"/>
    </fileset>
   </classpath>
  </taskdef>
  <jrc srcdir="${reports.home}" destdir="${reports.home}" keepjava="no"/>
 </target>
</project>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值