Condition isreference
:
Test whether a given reference has been defined in this project and - optionally - is of an expected type.
So, try
<condition property="modules.classpath.set" else="false">
<isreference refid="modules.classpath"/>
</condition>
Also on that page, there is a link to a page that describes custom conditions. If none of the provided conditions meets your requirement, then just write one.
Update:
The logic of if
and unless
in <target>
is to check if the property has been set -- for if
, the target runs when the property has been set; for unless
, the target runs when the property has NOT been set -- not the value of the property.
I have never checked the code of the condition isreference
, but I think maybe the else="false"
should be removed.
If removing that part still doesn't help, then you may need to use some embedded groovy or beanshell script, or write your own condition.