How to check if a property exists?

You can use the Condition task with an isset condition.

<project default="test">

  <property name="a" value="a"/>

  <target name="test">

    <condition property="a.set" else="false">
      <isset property="a"/>
    </condition>

    <condition property="b.set" else="false">
      <isset property="b"/>
    </condition>

    <echo message="a set ? ${a.set}"/>
    <echo message="b set ? ${b.set}"/>

  </target>
</project>

Output:

test:
     [echo] a set ? true
     [echo] b set ? false

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)