开发者

ant script to use use two .properties files?

I want to know if it is possible to get an ant script to reference 2 different .properties files at once, and if so, how to accomplish this.

Assume that the properties contained within the tw开发者_如何学Co .properties files are mutually exclusive, i.e. the same property will not appear twice.

Thanks!


In addition to Ash answer.

You can use a different prefix attribute of property task, e.g

<property file="file1.properties" prefix="file1"/>
<property file="file2.properties" prefix="file2"/>

This way you can find out if both files have same properties and differentiate between them in your build script. For example if both files have property test, then after they are loaded with the above commands you will end up with properties named file1.test and file2.test.


You should be able to import any number of properties files with multiple <property file="..."> entries in your ant script (unless there's some subtlety to your question that I've missed?). Duplicate properties are OK, since in ant properties are immutable and whoever sets the property first "wins".

See http://ant.apache.org/manual/Tasks/property.html for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜