分享

Ant多项功能配置

 sam225 2010-04-15
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"
   failonerror="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./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>

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/boboo_2000_0/archive/2009/10/13/4666044.aspx

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多