Publishing Air Apps with ANT and FTP

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:

9 comments on this post.
  1. RIA Revolution » Pushing AIR Apps with ANT and FTP:

    […] Jensen walks through the details of pushing Adobe AIR applications with Apache ANT and FTP. This post explains a way to push current versions of your AIR application to your server, from […]

  2. reynacho:

    As always, sweet job!

  3. Cairngen with Cairngorm with UM Extensions | Axelology:

    […] http://www.axelscript.com/2008/10/07/publishing-air-apps-with-ant-and-ftp/ […]

  4. todisht:

    Axel, great job on the video, thank you. I’m new to ANT and I noticed in the video it looked like you have some tasks that look like they generate AS code. Is that true? If so, do you have some good resources I might be able to check out to learn how to do that? Thanks again, keep up the good work.

    –tim

  5. oyun:

    thanks

  6. netlog:

    thanks you

  7. paranoyalarim:

    vov, very thanks.

  8. Connex Enviromental:

    Thanks for the walkthrough, much appreciated.

  9. Thao Entwisle:

    http://hugo2witt487.webs.com/apps/blog/show/5332095-closet-organziation-systems-wonderful-reasons-you-should-buy

Leave a comment