Search code examples
phing

Check if property has been set in phing


How to check if property ${foo} has been set?

Bonus question: how to escape $ sign in <echo> so I could output ${foo} string (not the foo variable substitution)?

PS: tried to google and read documentation, but couldn't find the answers. It's likely I'm missing something


Solution

  • You need to place an isset element inside the if element.

    <if>
        <isset property="foo" />
    

    The manual is available here.