Yes, you can. For instance:
<target name="importFile" depends="myProperty.check" if="myPropertyIsSet">
<echo>Import my file here</echo>
</target>
<target name="myTarget.check">
<condition property="myPropertyIsSet">
<and>
</and>
</condition>
</target>
Available conditions are described in the Apache Ant Manual .
source
share