Overview
* Since 10.1.3.3
Prepare Dependencies
* Unzip ‘OracleAS_2\integration\esb\deployment\documentation.zip’ into a temp directory.
* Copy ‘ESBMetadataMigration.jar’ file to your ESB project root directory.
* Download and unzip jaxb version 2 (e.g. jaxb-ri-20100511) from https://jaxb.dev.java.net/ into c:\lib directory.
* Download and unzip Apache httpclient (e.g. commons-httpclient-3.1) from http://hc.apache.org/downloads.cgi into c:\lib directory.
setantenv.bat
* Create a setantenv.bat file in the ESB project root directory.
set jaxb_home=C:\lib\jaxb-ri-20100511 set esb_home=C:\product\10.1.3.1\OracleAS_2 set classpath=%jaxb_home%\lib\activation.jar;%jaxb_home%\lib\jaxb-api.jar;%jaxb_home%\lib\jaxb-xjc.jar;%jaxb_home%\lib\jaxb-impl.jar;%jaxb_home%\lib\jaxb1-impl.jar;%jaxb_home%\lib\jsr173_1.0_api.jar;%esb_home%\lib\xmlparserv2.jar;%esb_home%/integration/esb/lib/commons-codec-1.3.jar
build.properties File
* Create a build.properties file in the ESB project root directory.
commons.httpclient.home=C:/lib/commons-httpclient-3.1 jaxb.home=C:/lib/jaxb-ri-20100511 esb.deployment.plan=local esb.deployment.plan.prefix=${ant.project.name}-esbplan esb.deployment.plan.template=${esb.deployment.plan.prefix}-template.xml esb.deployment.plan.used=${esb.deployment.plan.prefix}-${esb.deployment.plan}.xml esb.home=C:/product/10.1.3.1/OracleAS_2 esb.host=localhost esb.port=80 oc4j.admin.user=oc4jadmin oc4j.admin.password=welcome1
build.xml File
* Create a build.xml file in the ESB project root directory.
<project name="MyESBProject" basedir="." default="init" xmlns:esb="antlib:oracle.tip.esb.client.anttasks"> <property file="./build.properties"/> <dirname property="esb.project.dir" file="./build.xml"/> <!-- ESB deployment classpath --> <path id="esb.cp"> <pathelement location="${esb.project.dir}/ESBMetadataMigration.jar"/> <pathelement location="${commons.httpclient.home}/commons-httpclient-3.1.jar"/> <pathelement location="${esb.home}/lib/xmlparserv2.jar"/> <pathelement location="${esb.home}/integration/esb/lib/commons-logging.jar"/> <pathelement location="${esb.home}/integration/esb/lib/commons-codec-1.3.jar"/> <pathelement location="${esb.home}/integration/esb/lib/oraesb.jar"/> <pathelement location="${jaxb.home}/lib/activation.jar"/> <pathelement location="${jaxb.home}/lib/jaxb-api.jar"/> <pathelement location="${jaxb.home}/lib/jsr173_1.0_api.jar"/> <pathelement location="${jaxb.home}/lib/jaxb-impl.jar"/> </path> <taskdef uri="antlib:oracle.tip.esb.client.anttasks" resource="oracle/tip/esb/client/anttasks/antlib.xml" loaderref="oracle.esb.ant"> <classpath refid="esb.cp"/> </taskdef> <target name="init"> <echo>$${esb.project.dir}: ${esb.project.dir}</echo> <echo>$${esb.deployment.plan.template}: ${esb.deployment.plan.template}</echo> </target> <target name="extract.plan"> <delete file="${esb.project.dir}/${esb.deployment.plan.template}"/> <esb:extractESBDeploymentPlan sourcedir="${esb.project.dir}" deploymentplanfile="${esb.project.dir}/${esb.deployment.plan.template}"/> </target> <target name="deploy"> <esb:deployESBSuitcase esbmetadataserverhostname="${esb.host}" esbmetadataserverport="${esb.port}" username="${oc4j.admin.user}" password="${oc4j.admin.password}" deploymentplanfilename="${esb.project.dir}/${esb.deployment.plan.used}" sourcedirectory="${esb.project.dir}"/> </target> <target name="undeploy" description="Undeploy MyESBProject ESB"> <xmlproperty file="MyESBGroup.esbgrp" prefix="MyESBGroup"/> <property name="MyESBGroup.guid" value="${MyESBGroup.serviceGroup(guid)}"/> <xmlproperty file="MyJMSAdapter.esbsvc" prefix="MyJMSAdapter"/> <property name="MyJMSAdapter.guid" value="${MyJMSAdapter.service(guid)}"/> <xmlproperty file="MyFileAdapter.esbsvc" prefix="MyFileAdapter"/> <property name="MyFileAdapter.guid" value="${MyFileAdapter.service(guid)}"/> <xmlproperty file="AnotherFileAdapter.esbsvc" prefix="AnotherFileAdapter"/> <property name="AnotherFileAdapter.guid" value="${AnotherFileAdapter.service(guid)}"/> <xmlproperty file="MyJMSAdapter_RS.esbsvc" prefix="MyJMSAdapter_RS"/> <property name="MyJMSAdapter_RS.guid" value="${MyJMSAdapter_RS.service(guid)}"/> <esb:undeployESBEntities esbmetadataserverhostname="${esb.host}" esbmetadataserverport="${esb.port}" username="${oc4j.admin.user}" password="${oc4j.admin.password}"> <serviceGroup guid="${MyESBGroup.guid}"/> <service guid="${MyJMSAdapter.guid}"/> <service guid="${MyFileAdapter.guid}"/> <service guid="${AnotherFileAdapter.guid}"/> <service guid="${MyJMSAdapter_RS.guid}"/> </esb:undeployESBEntities> </target> <target name="redeploy" description="Redeploy MyESBProject ESB" depends="undeploy,deploy"/> </project>
Run ant targets
* Change directory to ESB project root directory.
* Run setantenv.bat to setup ant classpath.
* Run ‘ant extract.plan’ to extract deployment plan template from ESB project. Template file is created in the ESB project root directory with name MyESBProject-esbplan-template.xml.
* Copy template file and name it to match the target deployment environment (e.g. MyESBProject-esbplan-test.xml). Modify plan file accordingly.
* Set esb.deployment.plan property in build.properties file to the target environment (e.g. esb.deployment.plan=dev).
* Run ‘ant deploy’ to deploy ESB project.
* Run ‘ant undeploy’ to undeploy.
* Run ‘ant redeploy’ to undeploy followed by deploy.
References
* Enterprise Service Bus Ant Deployment Feature
* Deploying ESB projects using Ant