ant简例2

    技术2025-02-11  12

    <?xml version="1.0"?>

    <project name="TestJSF" basedir="." default="compile">    <!-- <property file="build.properties"/>-->       <property name="tomcat.home" value="D:/tomcat5.5.26"/>

        <property name="src.dir" value="src"/>    <property name="web.dir" value="WebRoot"/>    <property name="lib.dir" value="${web.dir}/WEB-INF/lib"/>    <property name="page.dir" value="${web.dir}/pages"/>    <property name="class.dir" value="${web.dir}/WEB-INF/classes"/>    <property name="name" value="TestJSF"/>

        <path id="master-classpath">        <fileset dir="${lib.dir}">            <include name="*.jar"/>        </fileset>        <!-- We need the servlet API classes:        -->        <!--   for Tomcat 4.1 use servlet.jar        -->        <!--   for Tomcat 5.0 use servlet-api.jar    -->        <!--   for Other app server - check the docs -->        <fileset dir="${tomcat.home}/common/lib">            <include name="servlet*.jar"/>        </fileset>        <pathelement path="${class.dir}"/>    </path>

        <target name="compile" description="Compile main source tree java files">        <mkdir dir="${class.dir}"/>        <javac destdir="${class.dir}" target="1.3" debug="true"               deprecation="false" optimize="false" >            <src path="${src.dir}"/>            <classpath refid="master-classpath"/>        </javac>    </target>       <target name="deploy" depends="compile" description="Deploy application">     <echo message="Deploy all file in the project to tomcat."/>        <copy todir="${tomcat.home}/webapps/${name}" preservelastmodified="true">            <fileset dir="${web.dir}">                <include name="WEB-INF/**"/>            </fileset>        </copy>        <copy todir="${tomcat.home}/webapps/${name}" preservelastmodified="true">            <fileset dir="${page.dir}">                <include name="**/**"/>            </fileset>        </copy>        <copy todir="${tomcat.home}/webapps/${name}/WEB-INF/lib" preservelastmodified="true">            <fileset dir="${lib.dir}">                <include name="*.jar"/>            </fileset>        </copy>         <copy todir="${tomcat.home}/webapps/${name}/images" preservelastmodified="true">            <fileset dir="${web.dir}/images">                <include name="**/**"/>            </fileset>        </copy>     <!--        <copy todir="${tomcat.home}/webapps/${name}/scripts" preservelastmodified="true">            <fileset dir="${web.dir}/scripts">                <include name="**/**"/>            </fileset>        </copy>        <copy todir="${tomcat.home}/webapps/${name}/styles" preservelastmodified="true">            <fileset dir="${web.dir}/styles">                <include name="**/**"/>            </fileset>        </copy>-->    </target>

        <target name="deploy-web" description="deploy only web to servlet container's deploy directory">     <echo message="Deploy all static file to tomcat."/>        <copy todir="${tomcat.home}/webapps/${name}">            <fileset dir="${page.dir}">                <include name="**/**"/>            </fileset>        </copy>        <copy todir="${tomcat.home}/webapps/${name}">            <fileset dir="${web.dir}">                <include name="WEB-INF/classes/**"/>            </fileset>        </copy>    </target>

        <target name="deploy-classes" description="deploy only web to servlet container's deploy directory">     <echo message="Deploy classes to tomcat."/>     <copy todir="${tomcat.home}/webapps/${name}/WEB-INF" preservelastmodified="true">            <fileset dir="${web.dir}">                <include name="WEB-INF/classes/**"/>            </fileset>        </copy>    </target>  <target name="undeploy" description="undeploy war file to servlet container's deployment dir">        <echo message="Undeploying webapp from Tomcat"/>        <delete dir="${tomcat.home}/webapps/${name}"/> </target>  <property name="class.name" value="com.wxt.reports.JasperApp" /> <property name="file.name" value="FirstJasper" /> <property name="classes.dir" value="${class.dir}" /> <property name="lib.dir" value="${web.dir}/WEB-INF/lib" /> <property name="fonts.dir" value="fonts" />  <path id="classpath">  <pathelement location="./"/>  <pathelement location="${classes.dir}" />  <pathelement location="${fonts.dir}" />  <fileset dir="${lib.dir}">   <include name="**/*.jar"/>  </fileset> </path>

     <!--  Deletes all the generated files. --> <target name="clean">  <delete dir="${classes.dir}" /> </target>         </project>

    最新回复(0)