"global var" in ant
I'm calling one target (e.g target
) from other targets (e.g. first
, second
). Is there a way to define a property (or whatever) in target
in such a way that it could be used in first
and开发者_Go百科 second
. Please don't advise me to pass a variable as a parameter into first
and second
Every "variable" (property) ever set in ant is always "global"
<project name="foo" default="first">
<target name="first" depends="target">
<echo message="${foo}"/>
</target>
<target name="second" depends="target">
<echo message="${foo}"/>
</target>
<target name="target">
<property name="foo" value="bar"/>
</target>
</project>
In latest versions of ant you can use the "local" task to declare a variable as local.
Otherwise properties are always global.
精彩评论