ant 读取键值 属性 个文件

ant reading key value property files

我有一个这样的 属性 文件 (user.properties):

ip=10.161.16.755
names={"10.161.16.75":"v1"}
adminPassword=admin
sshUserName=r
sshPassword=v
vc.username=administrator@address.local

我想将 vc.usernamenames 读入一些变量,稍后在 ant 中使用它们。 我怎样才能做到这一点?

您可以在 build xml

中包含您的属性文件
<property file="user.properties"/>

现在您可以像使用变量一样使用属性文件中定义的所有键。例如:

${vc.username} 会给你 administrator@address.local

希望对您有所帮助