【发布时间】:2009-12-23 19:32:34
【问题描述】:
这是在 Windows XP 环境中。
我正在尝试安装和编辑一些具有默认设置的文件。我想使用 ${env} 中的项目更新这些设置
【问题讨论】:
-
您为什么要这样做?请提供更多上下文。 Ant 不是一种脚本语言。
标签: windows ant iteration environment build.xml
这是在 Windows XP 环境中。
我正在尝试安装和编辑一些具有默认设置的文件。我想使用 ${env} 中的项目更新这些设置
【问题讨论】:
标签: windows ant iteration environment build.xml
使用来自ant-contrib 的foreach,您可以迭代${env},例如:
<target name="run">
<foreach item="String" in="${env.CLASSPATH}" delim=";" property="x">
<echo message="${x}" />
</foreach>
</target>
我可以用 NAnt 做到这一点:
<target name="run">
<foreach item="String" in="${environment::get-variable('CLASSPATH')}" delim=";" property="x">
<echo message="${x}" />
</foreach>
</target>
【讨论】:
echoproperties 可能是您正在寻找的。 ant.apache.org/manual/OptionalTasks/echoproperties.html