antcall (https://ant.apache.org/manual/Tasks/antcall.html), , , , -antcall-properties.ant
<?xml version="1.0" encoding="UTF-8"?>
<project name="AntCall Properties and Params" default="first">
<property name="my.property" value="initial" />
<target name="first">
<echo message="main: my.property=${my.property}"/>
<antcall target="second" />
<antcall target="second">
<param name="my.property" value="changed"/>
</antcall>
<antcall target="second" />
</target>
<target name="second">
<echo message="second: my.property=${my.property}"/>
<antcall target="third" />
</target>
<target name="third">
<echo message="third: my.property=${my.property}"/>
</target>
</project>
ant -f example-antcall-properties.ant
Buildfile: example-antcall-properties.ant
first:
[echo] main: my.property=initial
second:
[echo] second: my.property=initial
third:
[echo] third: my.property=initial
second:
[echo] second: my.property=changed
third:
[echo] third: my.property=changed
second:
[echo] second: my.property=initial
third:
[echo] third: my.property=initial
BUILD SUCCESSFUL
Total time: 0 seconds
, "" "param" ( , , "" ), ( "param" ).
, https://ant.apache.org/manual/Tasks/antcall.html,
, , <param>.
:
ant -f example-antcall-properties.ant -Dmy.property="from command line"
Buildfile: example-antcall-properties.ant
first:
[echo] main: my.property=from command line
second:
[echo] second: my.property=from command line
third:
[echo] third: my.property=from command line
second:
[echo] second: my.property=from command line
third:
[echo] third: my.property=from command line
second:
[echo] second: my.property=from command line
third:
[echo] third: my.property=from command line
BUILD SUCCESSFUL
Total time: 0 seconds