Deploying Multiple SOA Composites through ANT Script

ANT script solution for deploying multiple SOA composites (SAR files) to Oracle SOA Suite in a single execution.


1. Prerequisites:


Oracle SOA Suite 11g/12c installed

ANT (1.9+) with Oracle SOA ANT tasks configured

Admin server credentials

Composite SAR files ready for deployment

2.ANT Script Template

Save as deploy-composites.xml

<project name="SOA-Composite-Deployer" default="deploy-all" basedir=".">
<!-- Properties Configuration -->
<property file="build.properties"/>
<!-- SOA ANT Task Definitions -->
<taskdef name="scac" classname="oracle.tip.tools.ant.SCACompose"
classpath="${oracle.home}/soa/modules/oracle.soa.common_11.1.1/tasks.jar"/>
 <taskdef name="sca-deploy" classname="oracle.tip.tools.ant.SCADeploy" classpath="${oracle.home}/soa/modules/oracle.soa.common_11.1.1/tasks.jar"/>
<!-- Main Deployment Target -->
<target name="deploy-all">
<antcall target="deploy-composite">
 <param name="composite.file" value="composites/OrderProcessing.sar"/>
 </antcall>
<antcall target="deploy-composite">
<param name="composite.file" value="composites/PaymentService.sar"/>
</antcall>
 <!-- Add more composites as needed -->
</target>
<!-- Individual Composite Deployment -->
<target name="deploy-composite">
<echo message="Deploying ${composite.file} to ${soa.server.url}"/>
<sca-deploy 
input="${composite.file}"
user="${admin.user}"
password="${admin.password}"
hosturl="${soa.server.url}"
overwrite="true"
 forceDefault="true"
configplan="configplans/${composite.name}_cfgplan.xml
 failonerror="true"/>
 <echo message="Successfully deployed ${composite.file}"/>
</target>
</project


3.Sample build.properties

# Admin Credentials
      • admin.user=weblogic
        admin.password=welcome1

        # SOA Server Details
        soa.server.url=t3://localhost:8001
        oracle.home=/opt/oracle/middleware

        # Deployment Options
        composite.name=OrderProcessing

        4.Execution Methods

        ant -f deploy-composites.xml

        With Property Overrides


        ant -f deploy-composites.xml -Dadmin.password=newpass -Dsoa.server.url=t3://prod-host:8001

        5.Advanced Features

        Parallel Deployment (12c+):


        <parallel threadCount="4">
          <antcall target="deploy-composite">
            <param name="composite.file" value="composites/Comp1.sar"/>
          </antcall>
          <antcall target="deploy-composite">
            <param name="composite.file" value="composites/Comp2.sar"/>
          </antcall>
        </parallel>

        Conditional Deployment:


        <target name="check-environment">
          <condition property="is.production">
            <equals arg1="${env.TARGET}" arg2="PROD"/>
          </condition>
        </target>

        <target name="deploy-prod" if="is.production">
          <!-- Production-specific deployment steps -->
        </target>

Comments

Popular posts from this blog

Interview question for File and FTP Adapter

What is boot.properties file and how to create

SSL Exceptions in Admin Server and Node Manager.