Ant loadfile override property

2019-02-23 16:54发布

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

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.

Any recommendations?

Thanks.

7条回答
神经病院院长
2楼-- · 2019-02-23 17:19

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>

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

查看更多
登录 后发表回答