build.properties:
##sql package
remoteServer=192.168.194.8
userID=etyu
password=234567
localSQLPath=D:\\2014Q3_RELEASE\\DEV
remoteSQLPath=/export/home/sql
sqlRelease=REL_2014Q3
####convert all files to unix format under this folder
formatFilePath=D:\\webapp\\WEB-INF\\jsp
##copy ear file to unix server
remoteServer622=622server
localEarPath=C:\\Users\\ff\\Downloads
remoteEarPath=/tmp/ss
earFile=earFile-3.5.0.ear
zipFile=zipFile.zip
##package a tar file
tarPath=E:\\CDC
tarFile=deploy_cdc_newenv.tar
build.xml
<?xml version="1.0" encoding="GB2312"?>
<project name="utility">
<!-- properies -->
<property file="build.properties" />
<target name="tar-sql-and-ftp-to-Unix" >
<echo>The local SQL folder is ${localSQLPath}</echo>
<echo>The remote SQL folder is ${remoteSQLPath}</echo>
<echo>The sqlRelease file is ${sqlRelease}.tar</echo>
<delete file="${localSQLPath}/${sqlRelease}.tar"/>
<!-- replace db schema to empty string for all sql scripts -->
<replace dir="${localSQLPath}" value="">
<include name="**/*.sql"/>
<replacetoken>SPRAPPP1.</replacetoken>
</replace>
<replace dir="${localSQLPath}" value="">
<include name="**/*.sql"/>
<replacetoken>PRPCAPPP1.</replacetoken>
</replace>
<!-- remove ctrlM -->
<fixcrlf eol="lf" eof="remove" srcdir="${localSQLPath}" includes="**/*" excludes="*.tar"/>
<tar destfile="${localSQLPath}/${sqlRelease}.tar">
<fileset dir="${localSQLPath}" excludes="*.tar" >
<include name="**/*"/>
</fileset>
</tar>
<ftp server="${remoteServer}" port="21"
userid="${userID}" password="${password}" action="put" binary="true" verbose="yes"
remotedir="${remoteSQLPath}">
<fileset dir="${localSQLPath}" includes="${sqlRelease}.tar" />
</ftp>
</target>
<target name="conver-file-to-unix-format" >
<echo>The source folder is ${formatFilePath}</echo>
<fixcrlf eol="lf" eof="remove" tab="remove" tablength="2" srcdir="${formatFilePath}" includes="**/*" excludes="**/*.tar,**/*.jar"/>
</target>
<target name="copyZipFileTo622">
<echo>The local ear pat is ${localEarPath}/${earFile}</echo>
<echo>The remote ear folder is ${remoteEarPath}</echo>
<ftp action="del" server="${remoteServer}" port="21"
userid="${userID}" password="${password}" remotedir="${remoteEarPath}">
<fileset>
<include name="*.zip"/>
</fileset>
</ftp>
<ftp server="${remoteServer}" port="21"
userid="${userID}" password="${password}" action="put" binary="true" verbose="yes"
remotedir="${remoteEarPath}">
<fileset dir="${localEarPath}" includes="${zipFile}" />
</ftp>
</target>
<target name="copyEarFileTo622">
<echo>The local ear pat is ${localEarPath}/${earFile}</echo>
<echo>The remote ear folder is ${remoteEarPath}</echo>
<ftp action="del" server="${remoteServer}" port="21"
userid="${userID}" password="${password}" remotedir="${remoteEarPath}">
<fileset>
<include name="*.ear"/>
</fileset>
</ftp>
<ftp server="${remoteServer}" port="21"
userid="${userID}" password="${password}" action="put" binary="true" verbose="yes"
remotedir="${remoteEarPath}">
<fileset dir="${localEarPath}" includes="${earFile},${fixEar}" />
</ftp>
</target>
<target name="copyFilesTo622">
<echo>The local file path is D:/JavaDev/SPRWebDevEAR/SPREAR/SPE_SPRWeb</echo>
<echo>The remote file path is ${remoteEarPath}/webEar</echo>
<ftp action="del" server="${remoteServer}" port="21"
userid="${userID}" password="${password}" remotedir="${remoteEarPath}/webEar">
<fileset>
<include name="**/*.*"/>
</fileset>
</ftp>
<ftp server="${remoteServer}" port="21"
userid="${userID}" password="${password}" action="put" binary="true" verbose="yes" depends="yes"
remotedir="${remoteEarPath}/webEar/WEB-INF">
<fileset dir="D://target">
<include name="classes/**/Util$333333.class" />
<include name="classes/**/NewQuoteEnquiryServiceBean999.class" />
</fileset>
<fileset dir="D:/webapp/WEB-INF" >
<include name="**/uu.jsp" />
</fileset>
</ftp>
<ftp server="${remoteServer}" port="21"
userid="${userID}" password="${password}" action="put" binary="true" verbose="yes"
remotedir="${remoteEarPath}/webEar">
<fileset dir="D:/webapp" >
<include name="resources/**/common.js" />
</fileset>
</ftp>
</target>
<target name="copyFilesTo382">
<ftp server="382Server" port="21"
userid="${userID}" password="${password}" action="put" binary="true" verbose="yes" depends="yes"
remotedir="/WEB-INF">
<fileset dir="D:/target">
<include name="classes/**/***po.class" />
</fileset>
</ftp>
</target>
<target name="tarFile" >
<delete file="${tarPath}/${tarFile}"/>
<!-- remove ctrlM -->
<fixcrlf eol="lf" eof="remove" srcdir="${tarPath}" includes="**/*" excludes="**/*.jar,**/*.doc,**/*.tar,**/*.zip"/>
<tar destfile="${tarPath}/${tarFile}">
<fileset dir="${tarPath}" excludes="**/*.tar,**/*.doc,**/*.zip" >
<include name="**/*"/>
</fileset>
</tar>
</target>
<target name="changeWebVersion">
<replaceregexp byline="false">
<regexp pattern="3.5.0.13"/>
<substitution expression="3.5.0.12"/>
<fileset dir="E:\\DevlopTools\\fileDiffReport">
<include name="*.prop"/>
</fileset>
<fileset dir="E:\\script\\dataConfig">
<include name="oo.xml.*"/>
</fileset>
</replaceregexp>
</target>
</project>