http://sourceforge.net/projects/nant/?source=directory
ant修改xml文件5
<?xml version="1.0" encoding="UTF-8"?>
<project name="database tasks" default="createDatabase" basedir=".">
<property name="database.pwd" value="${DB_PWD}" />
</project> 使用ant修改成
<?xml version="1.0" encoding="UTF-8"?>
<project name="database tasks" default="createDatabase" basedir=".">
<property name="database.pwd" value="${DB_PWD}" />
<property name="database.host" value="${DB_HOST}" />
</project>
<project name="database tasks" default="createDatabase" basedir=".">
<property name="database.pwd" value="${DB_PWD}" />
</project> 使用ant修改成
<?xml version="1.0" encoding="UTF-8"?>
<project name="database tasks" default="createDatabase" basedir=".">
<property name="database.pwd" value="${DB_PWD}" />
<property name="database.host" value="${DB_HOST}" />
</project>
uild.properties 定义一个变量
- newLine=\n
然后在ant中使用
<replaceregexpfile="xxx.xml"
match="</project>"
replace="${newLine}"
byline="true"/>
<concatappend="true"
fixlastline="true"eol="crlf"destfile=""xxx.xml"">
<propertyname="database.host"value=\"${DB_HOST}\"/>
</concat>
${newLine}
<\/project>
</concat>