[英]In an ANT build.xml file, how can I iterate over the items in the ${env} variable?
[英]How can I change a config file variable using ant build?
我正在使用Jboss 4/5,并具有一些具有默认配置设置的.war .properties文件
我想使用Windows XP环境变量中的信息更新这些设置。
$ {env} in ant
在包含属性文件之前,请导入环境变量:
build.xml文件:
<target name="build">
<!-- load enviroment properties -->
<property environment="env" />
<property file="test.properties" />
<echo>test: ${test}</echo>
</target>
test.properties文件:
test = ${env.TEMP}
我需要在几个文件中增加内部版本号。 由于我需要保留文件的格式以及注释,因此我使用了replaceregexp 。 在编写正则表达式时要小心,将表达式限制为仅查找所需的实例。
<replaceregexp
file="${dir.project}/build.properties"
match="(build\.number[ \t]*=).*"
replace="\1${build.number}"
flags="g"
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.