ANT and FTP : Geekin in the 7 cities

ANT and FTP

I’m using ANT to FTP files to my website. Before you can do this, you’ll need to download these…

  1. Apache ANT
  2. commons-net
  3. jakarta-oro

Here is a sample build file that uses the ANT FTP task.

<project name="ftp-project" default="load" basedir=".">
     <property name="remote-dir" value="/public_html"/>
     <property name="ftp-server" value="ftp.yourserver.net"/>
     <property name="username" value="jimmy-cracked-corn"/>
     <property name="password" value="and-i-dont-care"/>
     <target name="load" depends="images,content" />
     <target name="content">
     <!-- log into the server and send files that are different -->
          <ftp server="${ftp-server}"
               remotedir="${remote-dir}"
               userid="${username}"
               password="${password}"
               passive="yes"
               depends="yes"
               binary="no">
               <fileset dir=".">
                    <include name="**/*.css"/>
                    <include name="**/*.html"/>
               </fileset>
          </ftp>
     </target>
     <target name="images">
     <!-- log into the server and send files that are different -->
          <ftp server="${ftp-server}"
               remotedir="${remote-dir}"
               userid="${username}"
               password="${password}"
               passive="yes"
               depends="yes"
               binary="yes">
               <fileset dir=".">
                    <include name="**/*.gif"/>
                    <include name="**/*.png"/>
                    <include name="**/*.jpg"/>
               </fileset>
          </ftp>
     </target>
</project>

Comments

Leave a Reply

OpenID


Anonymous