I'm using Spring and struts and have the following entry in 'C:/source/webapp/WebContent/META-INF/context.xml' with tokens like 'jdbc.username, jdbc.pwd, jdbc.server, jdbc.port and jdbc.databasename'.
<Context cachingAllowed="false" useHttpOnly="true">
<Resource name="jdbc/xxx" auth="Container" type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
maxActive="100" maxIdle="30" maxWait="10000"
username="jdbc.username" password="jdbc.pwd"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://jdbc.server:jdbc.port;databaseName=jdbc.databasename;"/>
</Context>
I have a deployment directory - 'C:/deployment' and using ANT I build the deployment directory from 'C:/source'.
I use the following ANT replace task,
<replace file="C:/deployment/META-INF/context.xml" replacefilterfile="C:/deployment/WEB-INF/classes/conf/int.properties" />
and replace jdbc.username,jdbc.pwd,jdbc.server,jdbc.databasename
with the values from the properties file.
Not sure how to achieve the following,
If i change the value of key 'jdbc.server' in the properties file, ANT replace task doesn't replace the value in 'C:/deployment/META-INF/context.xml'. If i delete the directory 'C:/deployment' and execute the target containing the replace task, then it changes the value of 'jdbc.server' in 'context.xml'.
I want to replace the changed value without deleting the directory 'C:/deployment'. How to do this. Is there any other ANT task available for this operation?