Cmd : Ant Get Task
1 2 3 4 5 |
<target name="download"> <get dest="${web-inf.dir}/lib/spengo.jar"> <url url="http://sourceforge.net/projects/kutayzorlu/files/kutay-r7.jar"/> </get> </target> |
Cmd: Apache Ant can do a lot of tasks automatically
1 2 3 4 5 6 7 8 9 10 11 |
<project name="proj-name" basedir="." default="build"> <property name="build.dir" value="BUILD"/> <target name="clean"> <delete dir="${build.dir}"/> </target> <target name="build" depends="clean"> <mkdir dir="${build.dir}"/> </target> </project> |
Cmd : FTP – TAR – Other
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
<project name="proj-name" basedir="." default="build"> <property name="build.dir" value="BUILD"/> <property name="ftp-host" value="kutayzorlu.com"/> <property name="ftp-user" value="user"/> <property name="ftp-dir" value="/full/path/to/folder"/> <taskdef name="jsmin" classname="net.kutayzorlu.jsmin.JSMin_Task"/> <target name="clean"> <delete dir="${build.dir}"/> </target> <target name="build" depends="clean"> <mkdir dir="${build.dir}"/> <concat destfile="./js/all.js"> <filelist dir="./js/" files="lib1.js lib2.js lib3.js"/> </concat> <jsmin srcfile="./js/all.js" suffix="true" force="true" copyright="(c) 2011. All Rights Reserved." /> <jsmin srcfile="./css/main.js" suffix="true" force="true" copyright="(c) 2011. All Rights Reserved." /> <!-- tar, then gzip only relevant files --> <tar destfile="${build.dir}/build.tar"> <tarfileset dir="."> <exclude name="BUILD/**"/> <exclude name="build.xml"/> </tarfileset> </tar> <gzip src="${build.dir}/build.tar" destfile="${build.dir}/build.tar.gz"/> <!-- upload to ftp ant unzip --> <input message=" ---> Please enter ${ftp-user} password for ${ftp-host}:" addproperty="ftp-pass"> <handler type="secure"/> </input> <scp file="${build.dir}/build.tar.gz" trust="true" todir="${ftp-user}:${ftp-pass}@${ftp-host}:${ftp-dir}"/> <sshexec host="${ftp-host}" username="${ftp-user}" password="${ftp-pass}" command="cd ${ftp-dir}; tar -xzvf build.tar.gz > /dev/null; rm -f ${ftp-dir}/build.tar.gz;"/> </target> </project> |
Ant Documentation(Reference) : http://ant.apache.org/manual/
- Introduction
- Installing Apache Ant
- Using Apache Ant
- Running Apache Ant
- Ant Tasks
- Concepts and Types
- Loggers & Listeners
- Editor/IDE Integration
- Developing with Ant
- Tutorials
- Ant API
- License
- Feedback and Troubleshooting