• Follow us on Twitter
  • Add me on Linkedin
  • RSS
A Boston native changing the web one application at a time... close

  • Home
  • About

Blog - Latest News

Automate your staging builds with FTP SFTP & Ant

0 Comments/ in Automation / by ryancanulla
May 10, 2011
Tweet

Since returning to agency life, and this time at a much larger agency, I find myself working on more multi-tiered applications and sites. This often involves dependencies on server-generated assets, content, flashvars and anything else you can think of that would make debugging in my local environment a bit of work. There are many times where debugging on the server is either easier or a requirement (Facebook development). In situations like this I use FTP with ANT to build my project, then deploy my new build to staging. Special thanks to Brian Connatser for teaching me this stuff!

Project Requirements:
Apache Ant
Commons-net-2.2.jar
Jakarta-oro-2.0.8.jar

Step One: Installing ANT
*Note – If you are using the ANT plugin for Flash Builder you can skip this step.

First, you need to go and download Apache Ant [http://ant.apache.org/]. If your not currently familiar with Ant, check out this Post by Charles Newman. Once you have ANT, unzip and store it somewhere on your system.

Now that you have ANT stored on your computer, you need to add it to your class path. What this means is that once added you will be able to run the ‘ant’ command from anywhere on your system as if you we inside your-ant-install-dir/bin. Basically, this is a list of directories that your shell will look through when running a command. Now open terminal and trace your current $PATH variable.

echo $PATH

/Applications/apache-ant/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Adobe Flash Builder 4.5/sdks/4.1.1/bin:/usr/local/git/bin:/usr/X11/bin

When you look at your version you won’t see ‘/Applications/apache-ant/bin:’. This is because you haven’t added it yet. To add to your PATH variable run this command.

export PATH=$PATH:/Applications/apache-ant/bin

This will add your new path to the end of the list. Be careful if you have installed the developer tools that come with OSX as they ship with a version of ANT. If this happens, the one defined first will take precedence. To change this, you can modify your command to prepend your new class variable to your path listing by modifying the command.

export PATH=/Applications/apache-ant/bin:$PATH

Check what version you are currently using this command.

which ant

/Applications/apache-ant/bin/ant

Now you can run the ant command ant see some type of response.

ant
Buildfile: build.xml does not exist!
Build failed

This is good because it means everything is working correctly (we haven’t created a build yet).

Next, we need to modify a file that runs on startup, which will add this to our class path every time we reboot. To do so open .bash_profile with your favorite text editor. I use VI:

vi Users/yourusername/.bash_profile

Now add the export command to the .bash_profile file.

export PATH=/Applications/apache-ant/bin:$PATH

Now close out of your text editor. If you reboot you will see that you can run ANT without having to add it again to your class path.

Step Two: Get external JAR dependencies
Now that we have ant, we need to get the exernal libraries that will allow us to use FTP & SSH (SFTP). Go get the following:

jakarta-oro-2.0.8.jar – http://archive.apache.org/dist/jakarta/oro/
commons-net-2.2.jar – http://commons.apache.org/net/download_net.cgi
jsch-0-1-44.jar – http://www.jcraft.com/jsch/

Now that we have these, we need to add them to our ANT lib directory. If we have downloaded ANT, just drag these to /your-ant-directory/lib/. If you are using the ANT plugin, you can add these through the preferences in the IDE.

Flash-builder>preferences>ant>runtime>global entries>runtime>classpath>global entries>global entries>add external jars

That’s all you need to do to set up your system. Now we need to build some scripts to FTP.

Step Three:
Here is an example of how to implement these new features from within ant. If you are behind a firewall be sure to use “passive” mode on FTP and “trust” mode on SFTP.



← Understanding Accelerometer Development
Developing for Multiple Screens with Flash Builder 4.5 →
Comments

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

328Follower
  • jetskiSimple Unity GameMay 17, 2012, 10:39 am
  • snowLevelFirst Unity LevelDecember 22, 2011, 1:19 am
  • fbLogoCode Formatting in Flash BuilderMay 17, 2011, 8:23 pm
  • fbLogoDeveloping for Multiple Screens with Flash Builder 4.5May 17, 2011, 3:53 am
  • 554px-Apache-Ant-logoAutomate your staging builds with FTP SFTP & AntMay 10, 2011, 4:31 pm

Latest Tweets

ISBN: 1449339387
ISBN: 0596517742
ISBN: 978-0321683915

Interesting links

Besides are some interesting links for you! Enjoy your stay :)

Pages

  • About

Categories

  • Automation
  • Flash Builder
  • Uncategorized
  • Unity

Archive

  • May 2012
  • December 2011
  • May 2011
  • December 2010
  • November 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
© Copyright - ryancanulla.com - Wordpress Theme by Kriesi.at