2

I am trying to setup my build.xml to reference the ant-salesforce.jar from my project checkout. The directory structure is similar to this:

Project Dir
-> src
-> ant-salesforce.jar
-> build.xml

I am trying to reference the ant-salesforce.jar from the root directory of the project in my build.xml as shown below:

<project name="Test" default="test" basedir=".">

    <property environment="env"/>

    <taskdef resource="com/salesforce/antlib.xml">
      <classpath>
          <pathelement location="./ant-salesforce.jar" />
      </classpath>
  </taskdef>

    <target name="retrieve">
        <sf:retrieve username="${SRC_USERNAME}" password="${SRC_PASSWD}" serverurl="${SRC_URL}" retrieveTarget="src" unpackaged="src/package.xml"/>
    </target>

    <target name="deployValidate">
        <sf:deploy username="${DEST_USERNAME}" password="${DEST_PASSWD}" serverurl="${DEST_URL}" deployRoot="src" rollbackOnError="true" checkonly="true"/>
    </target>

    <target name="deploy">
        <sf:deploy username="${DEST_USERNAME}" password="${DEST_PASSWD}"    serverurl="${DEST_URL}" deployRoot="src" rollbackOnError="true" />
    </target>
</project>

However, it keeps giving me the following error:

build.xml:12: The prefix "sf" for element "sf:retrieve" is not bound.

Am I missing something when including the reference to the ant-salesforce.jar?

1

You are missing the namespace declaration for sf in the <project> node.

<project name="Test" xmlns:sf="antlib:com.salesforce" basedir=".">
| improve this answer | |
  • Hey Mark that worked!! But how do I know whether its using the ant-salesforce.jar from my project dir or one from the ant lib directory? UPDATE: removed the ant-salesforce.jar from ant lib directory and it still worked. Thanks – ShreyasD Mar 6 '17 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.