This post discusses and includes a video of how to publish your .air files to your server with an ANT script via FTP. ANT is a xml scripting language that can be used for many things, but in our case it’s going to be application deployment.

The Problem

When you create an air app and host it on a server somewhere, you often times have updates, and you need to publish a new .air file to the server so people that continue to download your app, get the newest, healthiest version. The problem with that is that after bug fix (which may take all of 2 minutes), you need to connect to your ftp site, or ssh, or email the new file to yourself, remote desktop into the server, and check your email and put the new file into it’s correct path on the server.

The Solution

Create an ANT Script that logs into you ftp site, and uploads the new files, and it goes from a some what menacing task, to being a delightful 2 or 3 click deployment. There are some things you have to do to eclipse to get the ftp tag to work right in ANT… They are listed below in the steps to take to get ANT up and going in eclipse or flexbuilder.

ftp.username = username
ftp.password = password
ftp.dir = dirToUploadFilesTo
ftp.server = myDomain.com
ftp.localDir = E:/ClickStats_Basketball_1_0/update

<target name="ftp-push-to-server">
<echo>Pushing files to ftp site: ${ftp.server}</echo>
<ftp
server = "${ftp.server}"
userid = "${ftp.username}"
password = "${ftp.password}"
action = "put"
remotedir = "${ftp.dir}"
verbose = "true"
>
<fileset id="ftp.upload.fileset" dir="${ftp.localDir}" />
</ftp>
</target>

The Video


Prerequisite: /using-the-air-update-framework

Your going to need to do a few things to make sure ant is working:

  1. follow the steps on adobe’s site
  2. once ant is installed (how to is in the previous link) you then need to make sure you have at least java 6 installed
  3. now in eclipse or flexbuilder open your prefrences > (in tree on left go to) Java > Installed JREs > click “Add” > Browse for “JRE home directory” > “C:\Program Files\Java\1.6.x” (or something like that) > it should find a bunch of system libs > then click “OK”
  4. WHILE STILL IN THE PREFERENCES WINDOW > verify new JRE is checked Preferences > Java > Installed JREs (should have jre1.6.xxx checked, INSTEAD OF Flex builder 3
  5. Preferences > Java > Compiler > (in first drop down) Compiler compliance level: select “6.0” instead of “5”
  6. NET Commons Jar file: commons-net-1.4.1.jar
  7. Getting FTP to work with Eclipse: getting-ftp-to-work-with-ant-in-eclipse
  8. ANT Commons Jar file: ant-commons-net.jar
  9. That should be all you have to do to get ANT up and running.

Links: