Skip to content

Instantly share code, notes, and snippets.

@cdcarter
Created February 27, 2017 18:59
Show Gist options
  • Save cdcarter/98064422beb38ee7452282c7450051df to your computer and use it in GitHub Desktop.
Save cdcarter/98064422beb38ee7452282c7450051df to your computer and use it in GitHub Desktop.
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="build.properties"/>
<property environment="env"/>
<!-- Setting default value for username, password and session id properties to empty string
so unset values are treated as empty. Without this, ant expressions such as ${sf.username}
will be treated literally.
-->
<condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
<condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
<condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>
<taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
<classpath>
<pathelement location="../ant-salesforce.jar" />
</classpath>
</taskdef>
<!-- Retrieve the information of all items of a particular metadata type -->
<target name="listMetadata">
<sf:listMetadata username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" metadataType="${sf.metadataType}"/>
</target>
<!-- Retrieve the information on all supported metadata type -->
<target name="describeMetadata">
<sf:describeMetadata username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment