write build.xml to depoly project in eclipse

1.create a build.xml in webContent as follows

 <?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
    Build file for 'GEDA'  
    Creation date : 2010-6-21
    Updated date : 2010-11-3
    Author : Lester Hao
    Copyright 2010 ThomsonReuters, Inc. All rights reserved.                                                           
    ====================================================================== -->
<project name="GEDA" default="war">
    <import file="properties.xml" />

<taskdef resource="org/apache/catalina/ant/catalina.tasks" classpathref="deployer.classpath" />

<target name="clean">
        <delete dir="build" />
        <delete dir="dist" />
    </target>

<target name="compile" depends="clean">
        <mkdir dir="build/classes" />
        <javac srcdir="src" destdir="build/classes" target="1.6" source="1.6" debug="true" classpathref="full.lib.path" encoding="UTF-8" />
        <copy todir="build/classes">
            <fileset dir="src">
                <exclude name="**/*.java" />
                <exclude name="**/.svn" />
            </fileset>
            <fileset dir="resources">
                <exclude name="**/*-test.xml" />
                <exclude name="**/.svn" />
            </fileset>
        </copy>
    </target>

    <target name="compile-test" depends="compile">
        <mkdir dir="build/classes" />
        <javac srcdir="test" destdir="build/classes" target="1.6" source="1.6" debug="true" classpathref="full.lib.path" encoding="UTF-8" />
        <copy todir="build/classes">
            <fileset dir="ut">
                <exclude name="**/*.java" />
                <exclude name="**/.svn" />
            </fileset>
            <fileset dir="resources">
                <include name="**/*-test.xml" />
                <exclude name="**/.svn" />
            </fileset>
        </copy>
    </target>

<target name="jar" depends="compile">
        <mkdir dir="dist" />
        <mkdir dir="build/metadata/META-INF" />
        <jar destfile="dist/${distribution.name}.jar" basedir="build/classes">
            <metainf dir="build/metadata/META-INF/" />
        </jar>
    </target>


    <target name="war" depends="jar">
        <copy file="WebContent/bundles/messages-MigrationTool.properties" tofile="WebContent/bundles/messages-MigrationTool_en-US.properties" overwrite="true" />
        <copy file="WebContent/bundles/messages-IFFM.properties" tofile="WebContent/bundles/messages-IFFM_en-US.properties" overwrite="true" />
        <war destfile="dist/${webapp.name}.war" webxml="WebContent/WEB-INF/web.xml">
            <fileset refid="web.path" />
            <classes dir="build/classes" />
            <webinf dir="WebContent/WEB-INF" includes="schema/**"/>
        </war>
    </target>


<target name="refresh">
        <antcall target="clean" />
        <antcall target="war" />
    </target>

    <target name="deploy" description="Install application in Tomcat" depends="war">
        <deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${context-path}" war="dist/${webapp.name}.war" update="true" />
        <echo message="complete deploy">
        </echo>
    </target>
    
    <target name="deploy-local" description="Install application to Local Tomcat" depends="war">
        <copy todir="${tomcat.webapps}">
            <fileset dir="dist">
                <include name="*.war" />
            </fileset>
        </copy>
    </target>
    
    <target name="undeploy" description="Remove application in Tomcat" if="already.deployed" depends="stop">
        <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${context-path}" />
    </target>
    <!-- deploy into local tomcat webapps-->
    <target name="deploy-web" if="tomcat.home" description="copy jsp and resource into the servlet container's deployment directory">
        <copy todir="${tomcat.home}/webapps/${webapp.name}/">
            <fileset refid="web.path" />
        </copy>
    </target>

    <target name="reload" description="Reload application in Tomcat">
        <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${context-path}" />
    </target>

    <target name="start" description="Start Tomcat application" if="already.deployed">
        <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${context-path}" />
    </target>

    <target name="stop" description="Stop Tomcat application" if="already.deployed">
        <stop url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${context-path}" />
    </target>

    <target name="list" description="List Tomcat applications">
        <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
    </target>

    <target name="document" depends="compile">
        <mkdir dir="build/apidocs" />
        <javadoc sourcepath="src" destdir="build/apidocs" packagenames="com.${company.name}.*" classpathref="full.lib.path" encoding="UTF-8" />
        <zip destfile="docs/${distribution.name}-apidoc.zip" basedir="build/apidocs" update="true" />
    </target>
    <target name="ftp">
        <ftp server="${ftp.server}" remotedir="${ftp.remotedir}" userid="${ftp.user}" password="${ftp.password}" depends="yes">
            <fileset refid="ftp.path" />
        </ftp>
    </target>

</project>

2.create a build.properties  in webContent as follows

tomcat.home=D:\\bak\\tomcat6.0.13
tomcat.manager.url=http://192.111.63.10:8080/manager
tomcat.manager.username=tomcat
tomcat.manager.password=tomcat
project.name=GEDA


3.create a properties.xml  in webContent as follows

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <property file="build.properties" />
    <property environment="env" />
    <property name="company.name" value="IBC" />
    <!--     
    <property name="project.name" value="GEDA" />
    -->
    <property name="version" value="1.0" />
    <property name="distribution.name" value="${company.name}-${project.name}-${version}" />
    <property name="webapp.name" value="${project.name}" />
    <property name="context-path" value="/${webapp.name}" />

    <!-- configure the file path -->
    <path id="devtime.lib.path">
        <fileset dir="lib" includes="devtime/**/*.jar" />
    </path>
    
    <path id="deployer.classpath">
            <fileset dir="${tomcat.home}/lib">
                <include name="**/*.jar" />
            </fileset>
            <path refid="devtime.lib.path" />
    </path>
    
    <path id="full.lib.path">
        <fileset dir="WebContent" includes="WEB-INF/**/*.jar" />
        <path refid="deployer.classpath" />
    </path>

    <fileset id="web.path" dir="WebContent">
        <exclude name="WEB-INF/**/*.*" />
    </fileset>    

    <fileset id="ftp.path" dir="dist">
        <exclude name="*.war" />
    </fileset>

    <property name="ftp.server" value="sdd01a" />
    <property name="ftp.remotedir" value="/u05/workarea/lester" />
    <property name="ftp.user" value="gedasp" />
    <property name="ftp.password" value="gedasp" />
</project>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值