I have the following Ant buildfile importer.xml
:
<project name="importer" basedir=".." default="build">
<import file="imported.xml"/>
<target name="build">
<!-- Do some stuff... -->
<property name="isRunningFromImporter" value="true"/>
<antcall target="run-now"/>
</target>
</project>
And another buildfile imported.xml
that uses the ant-contrib tasks:
<project name="importer" basedir=".." default="build">
<!-- Most of file omitted for brevity -->
<target name="run-now">
<if>
<not-equals arg1="${isRunningFromImporter}" arg2="true"/>
<then>
<!--
This should only execute when the
isRunningFromImporter property is not true.
-->
</then>
</if>
</target>
</project>
The imported#run-now
target can be ran as a standalone Ant task, for example:
ant -buildfile imported.xml run-now
In this case I do not want the <then>
clause/task executed. However, if you run the same task as it is imported into importer.xml
:
ant -buildfile importer.xml build
Then I want the <then>
clause/task to execute, however, Ant does no allow me to see a property in one file and read it in another. Any ideas? Thanks in advance!