在ant中定义一个列表或一组变量 [英] Define a list or a set of variables in ant

查看:237
本文介绍了在ant中定义一个列表或一组变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ant构建文件中定义一个变量列表,以便在我的任务中使用for循环。我该怎么做?

I'd like to define a list of variables in ant build file in order to use for loop with this list in my tasks. How can I do that?

ps:应该是这样的:

p.s.: It should be something like the following:

<varlist name="mylist"> <!-- Actually, there is no such tag in Ant -->
    <item>someThing</item>
    <item>anotherThing</item>
</varlist>

...

<for param="item" list="${mylist}">
    <sequential>
        <echo>@{item}</echo>
    </sequential>
</for>


推荐答案

不知道这个是你的意思:

Not sure if this is what you meant:

<echo message="The first five letters of the alphabet are:"/>
<for list="a,b,c,d,e" param="letter">
  <sequential>
    <echo>Letter @{letter}</echo>
  </sequential>
</for>

这篇关于在ant中定义一个列表或一组变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆