Tuesday, September 16, 2008

automating creation of Cross Reference(Xreftool) tables using ant

I had used an ant script to create cross reference tables in one of my projects .I am sharing the code so that it will be useful. This good thing if you have an ant script is that you can create cross reference tables on different environment by modifying the build.properties.


build.xml

<project name="XrefTest" default="install" basedir=".">

<!-- First override from build.properties in process.dir, if available -->

<property file="build.properties"/>

<target name="checkEnv">

<condition property="bat.or.sh" value="bat" >

<os family="windows" />

</condition>

<condition property="bat.or.sh" value="sh" >

<os family="unix" />

</condition>

<condition property="windows.or.unix" value="cmd.exe" >

<os family="windows" />

</condition>

<condition property="windows.or.unix" value="/bin/sh" >

<os family="unix" />

</condition>

<condition property=" fileName" value="/c xreftool.${bat.or.sh} -f createtable.txt" >

<os family="windows" />

</condition>

<condition property=" fileName" value="xreftool.${bat.or.sh} -f createtable.txt" >

<os family="unix" />

</condition>

</target>

<target name="install" depends="checkEnv">

<exec dir="${esb.bin.path}" executable="${windows.or.unix}">

<env key="DB_URL" value="${DB_URL}"/>

<env key="DB_USER" value="${DB_USER}"/>

<env key="DB_PASSWORD" value="${DB_PASSWORD}"/>

<env key="OC4J_USERNAME" value="${OC4J_USERNAME}"/>

<env key="OC4J_PASSWORD" value="${OC4J_PASSWORD}"/>

<arg line="${fileName}"/>

</exec>

</target>

</project>


#build.properties

oracle.home="your oracle home"

esb.bin.path="${ oracle.home } \\integration\\esb\\bin"

OC4J_USERNAME=oc4jadmin

OC4J_PASSWORD=welcome1

DB_URL=jdbc:oracle:thin:@localhost:1521:XE

DB_USER=geo

DB_PASSWORD=geo


#createTable.txt

createTable TESTTABLE1

addColumns TESTTABLE1 sfdc_id,ebiz_id,ref_id


No comments: