简体   繁体   English

在Ant中调用Depends任务之前定义参数

[英]Define parameter before calling to the depends task in Ant

I want to define parameter before calling to the target of the depends task for example: 我想在调用depends任务的目标之前定义参数,例如:

<target name="init">
...
If (mode=true)
  Then...
       Else...
      ...
       </target>
<target name="Create File" depends="init">
...
       ...
       </target>

I want to define parameter called mode and give it for example true value and I want to do it once I started the "Create File" before calling the depends="init" task because I want the Init task to use this parameter 我想定义一个名为mode的参数,并给它提供例如true值,我想在调用depends =“ init”任务之前启动“ Create File”一次,因为我希望Init任务使用此参数

Can I do this in Ant? 我可以在Ant中做到这一点吗?

Thanks 谢谢

You can't do this if you are using depends , but you can execute init target through antcall task . 如果你正在使用你不能做到这一点depends ,但你可以执行init通过目标antcall任务

Here is an example from the above link 这是上面链接的一个例子

<target name="Create File">
  <antcall target="init">
    <param name="param1" value="value"/>
  </antcall>
</target>

<target name="init">
  <echo message="param1=${param1}"/>
</target>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM