【发布时间】:2010-12-04 08:10:24
【问题描述】:
我使用的是 Jboss 4/5,并且有一些带有默认配置设置的 .war .properties 文件
我想使用来自 windows xp 环境变量的信息来更新这些设置。
${env} 在 ant 中
【问题讨论】:
标签: windows ant jboss properties build
我使用的是 Jboss 4/5,并且有一些带有默认配置设置的 .war .properties 文件
我想使用来自 windows xp 环境变量的信息来更新这些设置。
${env} 在 ant 中
【问题讨论】:
标签: windows ant jboss properties build
在包含您的属性文件之前导入环境变量:
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}
【讨论】:
我需要在几个文件中增加内部版本号。因为我需要保留文件的格式以及 cmets,所以我使用了replaceregexp。编写正则表达式时要小心,将表达式限制为仅查找您关心的实例。
<replaceregexp
file="${dir.project}/build.properties"
match="(build\.number[ \t]*=).*"
replace="\1${build.number}"
flags="g"
/>
【讨论】: