3

.properties一度に 2 つの異なるファイルを参照する ant スクリプトを取得できるかどうか、もし可能であれば、これを達成する方法を知りたいです。

.properties2 つのファイルに含まれるプロパティは相互に排他的であると仮定します。つまり、同じプロパティが 2 回表示されることはありません。

ありがとう!

4

2 に答える 2

8

antスクリプトに複数のエントリを持つプロパティファイルをいくつでもインポートできるはずです<property file="...">(私が見逃した質問に微妙な点がない限り)。antプロパティは不変であり、最初にプロパティを設定した人が「勝つ」ため、重複するプロパティは問題ありません。

見る詳細については、 http://ant.apache.org/manual/Tasks/property.htmlを参照してください。

于 2009-12-16T05:26:43.420 に答える
8

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.

于 2009-12-16T17:32:58.943 に答える