function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDave_126SFDave_126 

Unable to retrieve metadata via ANT Migration Tool with no warinings

I'm trying to retrieve metadata about two Standard Objects and for some reason, I'm not getting any output from the ANT Migration Tool to troubleshoot. I have the following files defined:

build.xml
<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>
	
    <!-- See what happens here -->
    <target name="retrieveSOQL">
      <sf:retrieve 
          username="${sf.username}" 
          password="${sf.password}" 
          sessionId="${sf.sessionId}"
          serverurl="${sf.serverurl}" 
          retrieveTarget="../output" 
          unpackaged="package.xml"/>
    </target>
</project>

package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account</members>
        <members>Opportunity</members>
        <name>CustomObject</name>
    </types>
    <version>41.0</version>
</Package>
When I run 'ant -p retrieveSOQL', I get the following output with no information in my '..\output' directory:
 
Buildfile: C:\Users\test_user\Desktop\AntProjectFolder\salesforce\build.xml

Main targets:

Other targets:

 retrieveSOQL
Default target: test
I have the correct username/password specified in my 'build.properties' file so I know that's not the issue. Any ideas?

 
Manj_SFDCManj_SFDC
Did you append the security token to the password in the build.properties file
SFDave_126SFDave_126
I did, yes. Here's what I get when I run ANT Migration in debug mode:
 
​Apache Ant(TM) version 1.10.2 compiled on February 3 2018
Trying the default build file: build.xml
Buildfile: C:\Users\test_user\Desktop\AntProjectFolder\salesforce\build.xml
Detected Java version: 9 in: C:\Program Files\Java\jdk-9.0.4
Detected OS: Windows 10
parsing buildfile C:\Users\test_user\Desktop\AntProjectFolder\salesforce\build.xml with URI = file:/C:/Users/test_user/Desktop/AntProjectFolder/salesforce/build.xml
Project base dir set to: C:\Users\test_user\Desktop\AntProjectFolder\salesforce
parsing buildfile jar:file:/C:/apache-ant-1.10.2/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/apache-ant-1.10.2/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading C:\Users\test_user\Desktop\AntProjectFolder\salesforce\build.properties
 [property] Loading Environment env.
parsing buildfile jar:file:/C:/Users/test_user/Desktop/AntProjectFolder/salesforce/ant-salesforce.jar!/com/salesforce/antlib.xml with URI = jar:file:/C:/Users/test_user/Desktop/AntProjectFolder/salesforce/ant-salesforce.jar!/com/salesforce/antlib.xml from a zip file

Main targets:

Other targets:

 retrieveSOQL
Default target: test

 
SFDave_126SFDave_126
I figured it out. I had to drop the '-p' arg and double quote the target name.
Manj_SFDCManj_SFDC
Mark this as solved if this helps you, you too will fetch some points if the question is marked as solved :)
https://developer.salesforce.com/forums#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=ALLQUESTIONS&id=9060G000000MVrtQAG