Category Archives: ant-contrib

Ant ‘if’ with ‘equals’ doesn’t seem to be working

I'm running an Ant target in a Salesforce build.xml file. The target contains a task that loops through a list of strings separated by line endings in a .txt file (the 'metadata.types' variable in the code below references the .txt file, and I'm on Windows.)

One of the metatdata types in the list is 'CustomObject', so it should trigger the 'Sorting @{metadataType} buffer' echo statement below. However, it doesn't; it just skips through to the "i am at @{metadataType}" echo statement and prints out 'i am at CustomObject'.

What am I missing?

<for param="metadataType" list="${metadata.types}" delimiter="${line.separator}">
        <local name="type"/>
        <echo level="warning" message="Hello @{metadataType}"/>
            <equals arg1="@{metadataType}" arg2="CustomObject" />
                <echo level="info" message="Sorting @{metadataType} buffer"/>
                        <equals arg1="@{metadataType}" arg2=""/>
                        <echo level="warning" message="i am at @{metadataType}"/>
                        <xmltask sourcebuffer="pkgbuff" destbuffer="pkgbuff">
                            <insert path="/*[local-name()='Package']"><![CDATA[
                                </types> ]]>