Specifications
181
Chapter 9: Using Flex Ant Tasks
The Adobe® Flex® Ant tasks provide a convenient way to build your Flex projects using an industry-standard build
management tool. If you are already using Ant projects to build Flex applications, you can use the Flex Ant tasks
to replace your
exec or java commands that invoke the mxmlc and compc compilers. If you are not yet using Ant
to build your Flex applications, you can take advantage of these custom tasks to quickly and easily set up complex
build processes for your Flex applications.
The Flex Ant tasks feature includes two compiler tasks,
mxmlc and compc. You can use these to compile Flex appli-
cations, modules, and component libraries. In addition, the Flex Ant tasks include the
html-wrapper task that
lets you generate custom HTML wrappers and the supporting files for those wrappers.
The mxmlc and compc Flex Ant tasks extend the java Ant task. As a result, you can use all the available attributes
of the
java Ant task in those Flex Ant tasks. This includes fork, maxmemory, and classpath.
For more information on using Ant, see the Ant project web site at http://ant.apache.org.
Topics
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
Using Flex Ant tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182
Working with compiler options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184
Using the mxmlc task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187
Using the compc task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
Using the html-wrapper task. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190
Installation
Installing the Flex Ant tasks is a simple process. You copy a single JAR file from the Flex SDK ant directory to a
target directory. For Adobe® Flex® Builder™, the Flex Ant directory is located at flex_builder_install/sdks/3.0.0/ant.
For the SDK, the ant directory is located at sdk_install/ant.
Copy the flex_ant/lib/flexTasks.jar file to Ant's lib directory ({ant_root}/lib). If you do not copy this file to the lib
directory, you must specify it by using Ant's
-lib option on the command line when you make a project.
The Flex Ant directory also includes the source code for the Flex Ant tasks.










