lundi 30 mars 2015

Read properties file and substitute the value in template file through Ant script

I have two files local.properties.template and other is test.properties file.


local.properties.tamplate looks like



dir.source=@deploy.dir@/data/source
dir.storage=@deploy.dir@/data/storage
dir.reports=@deploy.dir@/data/reports
dir.scripts=@deploy.dir@/data/scripts
dir.dictionary=@deploy.dir@/data/dictionary
moveit.dir=@moveit.dir@

moveit.enabled=@moveit.enabled@
moveit.host=@moveit.host@
moveit.path=@moveit.path@
moveit.user=@moveit.user@
moveit.pass=@moveit.pass@
moveit.root=@moveit.root@
moveit.url=@moveit.url@


and test.properties looks like



moveit.dir=D:\\data\\moveit
moveit.enabled=false
moveit.host=thmdsdev0.tsh.tho.com
moveit.path=/moveitdmz
moveit.user=muttt
moveit.pass=ssss
moveit.root=/Home/MeaningfulUse
moveit.url=http://ift.tt/1DfmkdZ


I want through ant to read the value from test.properties for e.g moveit.user and paste it or add in the local.properties.template in place of @moveit.user@ and same for all variables.Then I will change the name of local.properties.template file to local.properties and move it other folder


Aucun commentaire:

Enregistrer un commentaire