Activity Forums Salesforce® Discussions How to deploy manage package through ANT migration tool?

  • Abhinav

    Member
    May 30, 2016 at 2:41 pm

    Hi Himanshu,

    You cannot directly use ANT to deploy managed packaged components.
    For deploying managed packages you have to use some ant macro like this :

    <macrodef name="installPackage" description="Installs the given managed package">
    <attribute name="namespace" description="Namespace of managed package to install."/>
    <attribute name="version" description="Version of managed package to install."/>
    <attribute name="packagePassword" description="Password used to install the pacakge. Optional." default=""/>
    <attribute name="username" description="Salesforce user name."/>
    <attribute name="password" description="Salesforce password."/>
    <sequential>
    <!-- Generate optional <password> element? -->
    <if><equals arg1="@{packagePassword}" arg2=""/>
    <then><property name="passwordElement" value=""/></then>
    <else><property name="passwordElement" value="<password>@{packagePassword}</password>"/></else>
    </if>
    <!-- Generate working folder and metadata files representing the package to install -->
    <delete dir="${basedir}/installdeploy"/>
    <mkdir dir="${basedir}/installdeploy"/>
    <mkdir dir="${basedir}/installdeploy"/>
    <mkdir dir="${basedir}/installdeploy/installedPackages"/>
    <echo file="${basedir}/installdeploy/package.xml"><![CDATA[<Package xmlns="http://soap.sforce.com/2006/04/metadata"><types><members>@{namespace}</members><name>InstalledPackage</name></types><version>28.0</version></Package>]]></echo>
    <echo file="${basedir}/installdeploy/installedPackages/@{namespace}.installedPackage"><![CDATA[<InstalledPackage xmlns="http://soap.sforce.com/2006/04/metadata"><versionNumber>@{version}</versionNumber>${passwordElement}</InstalledPackage>]]></echo>
    <sf:deploy deployRoot="${basedir}/installdeploy" username="@{username}" password="@{password}"/>
    </sequential>
    </macrodef>

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos