ant 中的动态属性名称 [英] Dynamic property names in ant

查看:41
本文介绍了ant 中的动态属性名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 ant 中读取文件并通过 loadproperties 加载属性.我对使用名称未知的特定属性的值感兴趣.我知道它遵循一种模式,因为这就是我加载属性的方式.

I am reading a file in ant and loading the properties through loadproperties. I am interested in using the value of a specific property, whose name is not known. I know that it follows a pattern because that is how I load the property.

我可以使用 echoproperties 并查看它正在加载.

I can echoproperties and see that it is being loaded.

但我不知道如何访问它的值,因为它的名字实际上是一个模式而不是硬编码.

But I dont know how to access its value, given that its name is actually a pattern rather that hardcoded.

如何访问此属性的值以进行一些处理.

How can I access this property's value to do some processing.

我希望这很清楚.请问我是否需要澄清一些.

I hope this is clear. Please ask if I need to clarify some more.

推荐答案

看看 ant-contrib 包.它的 propertycopy 任务将满足您的需求.如果您需要按照既定模式解析任意数量的属性,您可以将 ant-contrib 的 propertycopy 与 ant-contribs 的for"任务结合使用.

Take a look at ant-contrib package. Its propertycopy task will do what you need. If you need to resolve an arbitrary number of properties following an established pattern, you would use ant-contrib's propertycopy in conjunction with ant-contribs "for" task.

http://ant-contrib.sourceforge.net/tasks/tasks/index.html

这篇关于ant 中的动态属性名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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