Skip to main content

How to use "Apache Ant" a Force.com Migration Tool

Pre-requisite

  • Java JDK
  • Apache Ant, Version 1.6 or later
    • ANT Installation Instructions
      • Define these path variables
      • ANT_HOME = C:\Users\kumamuk01\dev\apache-ant-1.10.1
      • JAVA_HOME= C:\Program Files\Java\jdk1.8.0_121
    • Test if ANT is installed properly
    • Mac:
      • export PATH=/Users/kumarijl/apache-ant-1.9.14/bin:$PATH
Command Prompt > ant

Buildfile: build.xml does not exist!
Build failed

Command Prompt > ant -version

C:\Users\kumamuk01>ant -version
Apache Ant(TM) version 1.10.1 compiled on February 2 2017

Install the Force.com Migration Tool


You could follow the instructions given in README file within the package.

Configure Ant


Step - 1: Update build.properties file which contains environment information. Provide User Name and Password or Security Token which will be used by Ant to login to the Salesforce Org.


Step - 2: Update build.xml file to contain the build targets. Build targets are nothing but retrieve, deploy, etc. Please check various examples provided in example build.xml file. Generally, I would have "retrieveUnpackaged" in my development environment as default target and "deployunpackaged" in my Production environment or another Sandbox environment where I would be performing the regular deployment.


Step - 3: If internal network requires proxy setting, then it has to be configured in build.xml file.

  
<target name="proxy">
<property name="proxy.host" value="proxy.prod.company.com" />
<property name="proxy.port" value="9090" />
<!--If there username and password required -->
<property name="proxy.user" value="ntid" />
<property name="proxy.pwd" value="password" />
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" />
</target>

<!-- Test out deploy and retrieve verbs for package 'mypkg' -->
<target name="test" depends="proxy">
<!-- Upload the contents of the "mypkg" package -->
<!-- <sf:deploy username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="mypkg" rollbackOnError="true"/>
<mkdir dir="retrieveOutput"/> -->
<!-- Retrieve the contents into another directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="retrieveOutput" packageNames="MyPkg"/>
</target>


Scenario: While trying to login to salesforce using https://login.salesforce.com following error message is thrown: unable to reach to http://login.salesforce.com

Usage


List the build targets

> ant -p


Buildfile: C:\Users\kumamuk01\dev\salesforce_ant_39.0\test\build.xml

Main targets:

Other targets:

 bulkRetrieve
 cancelDeploy
 deployCode
 deployCodeCheckOnly
 deployCodeFailingTest
 deployCodeNoTestLevelSpecified
 deployCodeRunLocalTests
 deployLeadReport
 deployUnpackaged
 deployZip
 describeMetadata
 listMetadata
 quickDeploy
 retrieveCode
 retrieveLeadReport
 retrievePkg
 retrieveUnpackaged
 test
 undeployCode
Default target: test

retrieveUnpackaged components
>ant

References

Comments

Post a Comment

Popular posts from this blog

Product Evaluation - MuleSoft Anypoint Platform one day workshop

People, Business Executives, Enterprise Architects, Solution/System/Application Architects, Tech Leads, Developers,  who are looking for and want to know more about MuleSoft Integration offering which is compared to other key providers like Software AG WebMethods, Oracle SOA Suite, WSO2, Informatica, etc. Recently I attended a one day Workshop on MuleSoft Anypoint platform . The overall goal of this workshop was to evaluate MuleSoft integration technology offering for a mid-size integration environment which is currently supported through Software AG WebMethods and Oracle SOA Suite. So, if you are in process of evaluating MuleSoft Anypoint Platform for your integration needs, this write up will give you a good high level executive summary overview. MuleSoft Product Offering falls under following category of market offering: iPaaS (Integration Platform as a Service) Hybrid Integration On-Premise Integration Platform Internet of Things (#IOT) Integration Mule

Salesforce - Scheduling a Schedule Job

Following are the different ways to schedule a Schedule Job through a script. Run the given code in Execute Anonymous window and then you could see in Setting -> 'Scheduled Job' that your Job is waiting to be executed. Run a Schedule Job NOW Method - 1 ScheduleSalesTargets c = new ScheduleSalesTargets(); c.execute(null); Method - 2  (This one I prefer, whenever I need to run a job) Check the current Time. If it is, let's say 10:39 AM, in your clock, then set the minute to 41. This will schedule the job for 10:41 AM just two minutes from now. But, if you set minute value to 38, then it will schedule to next hour 11:38 AM ScheduleSales c = new ScheduleSales(); String sch = '0 0 * * * ?'; System.schedule('Sales Job Name - 1',  '0 41 * * * ?', c); You could repeat following, so that job keeps running every 5 minutes while you debug and change the Apex code behind the scene. ScheduleSales c = new ScheduleSales(); String sch = &#

Salesforce - Microsoft Power BI

This document outlines basic steps to install and configure Power BI with Salesforce. Usage / Highlights Retrieve User Data from Salesforce Retrieve Reports from Salesforce Read Only Access to Salesforce Connection to Salesforce is made on behalf of User. In other words, Login Session belongs to the User. Power BI utilises Salesforce OAuth security framework to connect to Salesforce Previous version of Power BI used to be Power Query, but not supported for TLS 1.1 or higher, thus could not connect to Salesforce after TLS 1.1 Security upgrade. Find details on Power Query Installation  here . Installation - Power BI Publisher for Excel Download Link  Download Power BI publisher for Excel Download for Office 64 Bit ( or 32 Bit) as needed. Close Microsoft Office Application Double click the installer file named "PowerBIpublisher_[64bit][en-us].msi" Installation - Power BI Desktop  Follow the guide as provide on this site -  https://powerbi.microsoft.com/e