简体   繁体   English

Ant:如何在replaceregexp中使用属性值作为替换

[英]Ant: How to use a property value as replacement in replaceregexp

I need to replace a regex match with a value from a properties file. 我需要用属性文件中的值替换正则表达式匹配。

It would look like: 它看起来像:

<replaceregexp 
        file="test.txt"
        match="blabla" 
        replace="some.property"
        >
</replaceregexp>

(That doesn't work, it's just to show what I need) (这不起作用,它只是为了显示我需要的东西)

some.property is in a file called test.properties some.property位于名为test.properties的文件中

I think that the problem is that you are using some.property instead of ${some.property}. 我认为问题在于您使用some.property而不是$ {some.property}。 That's how I have it working. 这就是我的工作方式。

使用loadproperties任务从文件加载属性。

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

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