ant script for zip
Java Project가 아닌 단순 Project를 생성하여 ZIP으로 압축한 후 배포 서버로 생성된 ZIP 파일을 전송한 후 압축을 해제하는 Ant Build Script이다.
■ Project ZIP Ant build script
<?xml version="1.0" encoding="UTF-8"?> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <project name="sehati-oz" default="main" basedir="."> <description> Description of your project </description>
<property name="ci.home" value="/engn001/ciserv" /> <property name="ci.job.home" value="${ci.home}/hudson/jobs" /> <property name="ci.app.home" value="${ci.job.home}/SEHATI-OZ-DEV/workspace" />
<property name="projectName" value="xxxx-oz" />
<!-- OZ sources --> <property name="oz.dir" location="oz" />
<property name="target.dir" value="${ci.app.home}/target" />
<property name="portal.ip" value=""/> <property name="ibm.ip" value="" /> <property name="was.port" value="" /> <property name="was.userid" value="" /> <property name="keyfile.dir" value="" /> <property name="was.tmp.src.dir" value="/tmp/src" />
<property name="aaa.oz.target" value="" /> <property name="bbb.oz.target" value="" />
<target name="main" depends="clean, init, zip, unzip, systemzip, deleteDir, copyTarget, unzip-oz" /> <target name="clean" description="Flush staging directory"> <delete dir="${staging.dir}" failonerror="false"/> </target> <target name="init"> <mkdir dir="${target.dir}" /> </target>
<target name="zip" depends="clean" description="package, output to ZIP"> <zip destfile="${target.dir}/${projectName}.zip" basedir="${oz.dir}" /> </target> <target name="unzip" depends="zip" description="package, output to UNZIP"> <unzip src="${target.dir}/${projectName}.zip" dest="${target.dir}" /> </target>
<!-- zip file according to system --> <target name="systemzip" depends="unzip" description="package, output to ZIP"> <zip destfile="${target.dir}/${projectName}_IBM.zip" basedir="${target.dir}/IBM" /> <zip destfile="${target.dir}/${projectName}_PORTAL.zip" basedir="${target.dir}/PORTAL" /> </target>
<!-- CI Oz unzip dir delete --> <target name="deleteDir" depends="unzip" description="package, output to ZIP"> <delete dir="${target.dir}/IBM" /> <delete dir="${target.dir}/PORTAL" /> </target>
<!--Copy to IBM, Porta WAS --> <target name="copyTarget" depends="deleteDir" description="package, output to ZIP"> <exec executable="scp" dir="." failonerror="true"> <arg value="-r"/> <arg value="-i"/> <arg value="${keyfile.dir}" /> <arg value="${target.dir}/${projectName}_IBM.zip" /> <arg value="${was.userid}@${ibm.ip}:${was.tmp.src.dir}"/> </exec> <exec executable="scp" dir="." failonerror="true"> <arg value="-r"/> <arg value="-i"/> <arg value="${keyfile.dir}" /> <arg value="${target.dir}/${projectName}_PORTAL.zip" /> <arg value="${was.userid}@${portal.ip}:${was.tmp.src.dir}"/> </exec> </target>
<!--unzip --> <target name="unzip-oz" depends="copyTarget"> <sshexec host="${ibm.ip}" username="${was.userid}" keyfile="${keyfile.dir}" port="${was.port}" command="sudo cp ${was.tmp.src.dir}/${projectName}_IBM.zip ${ibm.oz.target}; cd ${ibm.oz.target}; sudo unzip -o ${projectName}_IBM.zip; sudo rm -rf ${projectName}_IBM.zip; sudo chown tomcat:tomcat ${ibm.oz.target}" trust="true"/> <sshexec host="${portal.ip}" username="${was.userid}" keyfile="${keyfile.dir}" port="${was.port}" command="sudo cp ${was.tmp.src.dir}/${projectName}_PORTAL.zip ${portal.oz.target}; cd ${portal.oz.target}; sudo unzip -o ${projectName}_PORTAL.zip; sudo rm -rf ${projectName}_PORTAL.zip; sudo chown tomcat:tomcat ${portal.oz.target}" trust="true"/> </target>
</project> |