Ant conditional import

Is it possible to import a file into ant build.xml, if the property is set, if not, then do not import it.

Is there a way to use ant -contrib if task.

thank

+3
source share
1 answer

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>
            <!-- Conditions to check if my property is set. -->
        </and>
    </condition>
</target>

Available conditions are described in the Apache Ant Manual .

+2
source

Source: https://habr.com/ru/post/1751236/


All Articles