Setting up Apache Ant task

i) Before you can run Apache Ant effectively, you will need the Java Development Kit, available for download at: http://www.sun.com/java/
ii) Install the Java Development Kit, then you will need to add the jdk/bin directory to your system PATH variable. See adding a PATH environment variable: Windows, Mac, Linux (Ubuntu).

Windows Users, you can add to your path from the command prompt using the following command. Be sure to substitute the c:\Java\jdk\bin directory with the directory to your own jdk installation.

setCommandPath.JPG

1) Download Apache Ant 1.7.1 or higher from http://ant.apache.org/bindownload.cgi.
2) Extract the compressed file (e.g. - zip, tarball, etc) to a location on your computer, preferably without spaces in the path.
3) Append the /bin directory on your computer's PATH environment variable, using one of the methods described in "step ii."
4) Create an environment variable named ANT_OPTS with the following values to increase the JVM's heap boundaries and perm gen space to be more friendly to Flex/Flash builds:

-XX:MaxPermSize=128M -Xms128M -Xmx512M

Windows Users, the variable here has been created as a user variable. But may be more useful as a system variable depending on your needs:

antOptsVariable.JPG

5) Download the Flex SDK http://www.adobe.com/go/flex4_sdk_download and extract it to a folder on your computer.

If you are using Linux and wish to use the ADL support to execute your test suite(s), download the AIR SDK for Linux @ http://www.adobe.com/cfusion/entitlement/index.cfm?e=airsdk and extract the bundle on top of Flex SDK so the FlexUnit Ant task may use it correctly.

7) Create an environment variable named FLEX_HOME with the value of the absolute path to the directory in which the Flex SDK was extracted.

Windows Users:

flexHomeVariable.JPG

8) Download the stand alone debugger (projector) Flash Player for your platform http://www.adobe.com/support/flashplayer/downloads.html and install the player. If running on Linux, be sure to create a symlink to the executable with the name gflashplayer which is in a directory available on PATH environment variable.
9) If not running on Linux, associate the mime-type for SWF files with the stand-alone debugger Flash Player. If done correctly, opening a SWF file directly (e.g. - double-clicking the file) should cause it to open in the stand-alone player.

10) Download the latest FlexUnit4 source code bundle @ http://github.com/flexunit/flexunit/zipball/master.
11) Extract the FlexUnit4SampleCIProject from the bundle into a location you'd like to use for your project.
11B) If they exist, delete all folders and files under the /src/main/flex and /src/test/flex locations as well as the pom.xml file since this is a Maven build file.
12) Place any source code under /src/main/flex and your test code under /src/test/flex. Please note, you don't have to use these folder locations, the included build scripts are just setup to work without edits with these paths.
13) Sample build scripts are provided within the template as files beginning with the prefix build. There is a sample for using the stand-alone Flash Player and ADL to execute your test suite(s). These build scripts are just suggestions, there are many different ways to write an Ant build script, these samples are solely intended to present Ant in a simple manner.
14) When in doubt on how to organize your project or which build script to use, check out the comments in all of the build files as well as the README.txt file which comes with the FlexUnit4SampleCIProject.
15) Type in the command "ant" (without quotes) and the project should build.

The "BUILD SUCCESSFUL" message in the command line will alert you to a proper configuraton. Use and test this configuration with the sample project before moving onto any others.