开发者

"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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜