ant 将项目打包成EAR

 

 

<?xml version="1.0" encoding="UTF-8"?>

<project basedir="./" default="deploy" name="CPEWeb">



    <!--打包前修改-->

    <property environment="env" />

    <property name="jboss.home" value="${env.JBOSS_HOME}" />

    <property name="jbossDeploy.dir" value="${env.JBOSS_HOME}\server\all\farm" />

    <property name="system.name" value="CPEWeb" />

    <property name="target.dir" value="./target" />

    <property name="CPEEJB.dir" value="../CPEEJB/build/classes" />

    <property name="CPEEarContent.dir" value="./EarContent" />

    <property name="CJOnlineComm.dir" value="../CJOnlineComm/build/classes" />

    <property name="CPEWebContent.dir" value="./WebContent" />





    <target name="clean">

        <delete dir="${target.dir}" />

    </target>



    <target name="CJOnlineComm.jar" depends="clean">

        <copy todir="${target.dir}/lib">

            <fileset dir="../CJOnlineComm/lib" />

        </copy>

        <jar basedir="${CJOnlineComm.dir}" destfile="${target.dir}/lib/CJOnlineComm.jar">

            <exclude name="**/debug/" />

        </jar>

    </target>



    <target name="CPEEJB.jar" depends="CJOnlineComm.jar">

        <copy todir="${target.dir}/lib">

            <fileset dir="../CPEEJB/lib" />

        </copy>



        <jar basedir="${CPEEJB.dir}" destfile="${target.dir}/CPEEJB.jar">

            <exclude name="**/debug/" />

        </jar>

    </target>



    <target name="CPEWeb.war" depends="CPEEJB.jar">

        <war basedir="${CPEWebContent.dir}" warfile="${target.dir}/CPEWeb.war" webxml="${CPEWebContent.dir}/WEB-INF/web.xml" />

    </target>



    <target name="CPE.ear" depends="CPEWeb.war">

        <copy todir="${target.dir}/lib">

            <fileset dir="${CPEEarContent.dir}/lib" />

        </copy>



        <ear destfile="${target.dir}/CPE.ear" appxml="${CPEEarContent.dir}/META-INF/application.xml">

            <fileset dir="${target.dir}" />

        </ear>

    </target>



    <target name="make_all" depends="CPE.ear" />



    <!-- deploy -->

    <target name="deploy"  depends="make_all">

        <copy todir="${jbossDeploy.dir}">

            <fileset dir="${target.dir}/">

                <include name="**/*ear" />

            </fileset>

        </copy>

    </target>



</project>

 

你可能感兴趣的:(ant)