Compile Flex Builder project from command line

Herms picture Herms · Feb 23, 2009 · Viewed 16.9k times · Source

Is there an easy way to build projects created in FlexBuilder via the command line?

I'm beginning to work on adding a couple Flex components to the project I have at work. Currently the rest of the project (some java, some C++) is built via an ant script. I'd really like to be able to integrate the builds for the Flex components I'm working on into that ant script, but I'm not sure how to build the Flex projects from the command line.

Is there a way to invoke the flex compiler from the command line such that it uses the flex builder's project as its configuration? Or is there a way to modify FlexBuilder's compilation so that I could write a build script for the project and then have it use that (so that I'd only have one way to build and have both ant and FB use that, instead of separate build processes)?

While a flex ant task would be preferable it's not really necessary, as I can create custom tasks from command line apps easily enough.

EDIT:

One additional thing that I should probably mention. While I have FlexBuilder installed some of the people who run that ant script do not. They would just have the normal Flex SDK.

Answer

dw.mackie picture dw.mackie · Feb 23, 2009

You can use the -dump-config option in FB to dump the config.xml that FB is using to compile your project, and then use that (using the -load-config option) with your command-line build.

I know in regular Eclipse you can build from an ant file, and I'm pretty sure that you can do the same with FB.

Although the doc kind of stinks for the flex ant tasks, they work ok.

[EDIT]- I replied in the comments, but I wanted to flesh out my reply.
Herms is having a problem using -dump-config and -load-config and it kind of points out why the flex ant tasks are better. (I didn't want to be the guy who says "why do you want to do X?", so I just answered the asked question).

Even though their doc is subpar (imo), they're better suited for the task of building your projects.
There are a couple of gotchas using the flex ant tasks, but for the most part, it's not brain surgery (and really the gotchas are more because the doc sucks).

When I started working on the automated build for our project, I found this site:
http://www.nabble.com/FlexCoders-f16212.html

to be invaluable.