Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ant conditional import

Tags:

ant

Is it possible to import a file in ant's build.xml if a property is set, if not then don't import it.

Is there a way OTHER THAN using ant-contrib if task.

Thanks

like image 341
user373201 Avatar asked Feb 24 '26 04:02

user373201


1 Answers

Yes, you can. For example:

<target name="importFile" depends="myProperty.check" if="myPropertyIsSet">
    <echo>Import my file here</echo>
</target>

<target name="myTarget.check">
    <condition property="myPropertyIsSet">
        <and>
            <!-- Conditions to check if my property is set. -->
        </and>
    </condition>
</target>

Available conditions are described in Apache Ant Manual.

like image 82
uthark Avatar answered Feb 27 '26 00:02

uthark