Ant 加载文件覆盖属性 [英] Ant loadfile override property

查看:32
本文介绍了Ant 加载文件覆盖属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在循环中使用 Ant 任务 来解析文件的内容.我有类似的东西

I'm trying to use the Ant task <loadfile> in a loop to parse the contents of a file. I have something like

<loadfile srcFile="@{some.input}" property="my.property">

由于 Ant 属性是不可变的,这对我不起作用.我需要my.property"在每次迭代时更新.有没有办法实现这一目标?我知道 Ant-contrib 有一个 <var> 任务,但我不确定如何将 与它一起使用.

Since Ant properties are immutable, this doesn't work for me. I need 'my.property' to update on every iteration. Is there a way to achieve this? I know Ant-contrib has a <var> task but I'm not sure how to use <loadfile> with it.

有什么建议吗?

谢谢.

推荐答案

Ant 插件 Flaka 提供了一个 let 任务,允许覆盖现有的属性或变量 =

The Ant plugin Flaka provides a let task, allowing to overwrite existing properties or variables like that =

<project xmlns:fl="antlib:it.haefelinger.flaka">

<property name="my.property" value="value"/>
<fl:let> my.property ::= 'anothervalue'</fl:let>

</project>

所以不需要先取消设置然后再设置.顺便提一句.Flaka 也有一个未设置的任务 ;-)

So no need to unset first and set afterwards. btw. Flaka has a unset task also ;-)

这篇关于Ant 加载文件覆盖属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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