Configuring a swc to be used as an externally-linked library


i currently struggle to let IntelliJ to use a .swc in the form of an external library.
It always results in the classes from that swc being compiled into my resulting swf as well.
Here's what i tried:

Since the .swc is created by a module in my project, in the application that wants
to use that .swc as an external library, i created a module dependency and set it to "Provided".
I also tried "Runtime". Both had no effect (means, classes were still also in my .swf).

Then i tried something else and created a dependency using the "Module Library"
Dependency option and i selected the .swc directly. I then set it to "Provided". Also tried
"Runtime", no effect, classes were compiled into the resulting .swf

Then i looked into that temporary configuration file and saw, that regardless of what i configured,
the .swc is always included using the <library-path...> tag. But it should use the <external-library-path ...>
instead i thought. So i switched the module to "use custom compiler configuration file", let it point
to that same temporary file and simply changed the tag accordingly.

Funny thing is, it still doesn't work, those classes still end up in my .swf.

So, can someone give me a hint, what i might be missing? Thanks a ton.

Comment actions Permalink

'Use custom compiler configuration file' option should work always, I'd just advise to rename temporary configuration file to some custom name - this will guarantee that IDEA will not touch it.
But there's more easy way in IntelliJ IDEA 10. Try scope 'Provided' in latest IDEA 10 EAP:
Related issue:
And of course if your swc is produced by your module then you should have only module-on-module dependencies, not on swc directly.

Comment actions Permalink

Thanks for the answer. Good to see, that IntelliJ 10 will improve in that point. But i don't understand, why my custom configuration doesn't work NOW.

Here's how it looks like:

<flex-config xmlns="">







 <external-library-path append="true">








It compiles just fine, but the classes from framework.swc, which i use in this module, get compiled into my testbundle.swf as well.
I followed your advice and renamed the configuration file to a different name, than the original one.
Comment actions Permalink

That's strange and most probably it is a configuration issue rather than Flex compiler's bug. First of all make sure that compilation goes in the way you expect (Messages tool window). Check that classes that are undesirably included in swf are not under TestBundle/src source path. Try to compile your swf from command line. If still no idea on what's wrong please try to create simple illustrating project and attach it here.

Comment actions Permalink


ok. i checked the TestBundle/src path and made sure, there are no classes from Framework.
I also compiled using mxmlc on the commandline directly, but using the same configuration file.
Same result, classes from the framework.swc are still in my resulting swf.

So, it is definitely a configuration issue. But i cannot see, where i am making the mistake. Will
create a test project now and attach it here, then.

By the way, i did a test in Adobes Flash Builder in parallel. There it works, but Flash Builder is
using an .actionscriptProperties file instead of the flex-config. That property file has a different syntax,
so i cannot transfer, what i did there.

Comment actions Permalink

One more guess. Are classes that undesirably appear in your swf are core Flex framework classes, but not your own classes? By default Flex compiler uses <Flex SDK>/frameworks/flex-config.xml file as well and some swc's are mentioned there as library-path. So classes from those swc's will appear in compiled swf regardless on what is written in your custom compiler config file.
A hint: you may write '-dump-config=flash_builder_config.xml' as Additional compier options in Flash Builder and thus get its full compiler configuration that you may use it in IDEA then. I don't know if it will be 100% correct but could be useful anyway.

Comment actions Permalink


i don't want to shout too loud, but i think i found a compiler bug in flex sdk 4.1.

First of all, i forgot to mention earlier, that i was using the Frame Metatags in my code to spread my code onto multiple frames.

And i think, that's, what causes the trouble. It doesn't matter, if i use the Frame metatag or the corresponding
-frame compiler option, the result is the same.

I have attached a small test project for demonstration purposes.

There are two modules: TestApplication and TestLibrary.

TestApplication has two classes: HelloWorld and SecondClass.
TestLibrary has one class: MyTestClass.

In TestApplication, HelloWorld references MyTestClass from TestLibrary.

Through the use of the -frame compiler option i make sure, that SecondClass is pushed to a second

Also, in the configuration file of TestApplication i configure the TestLibrary as an external library.

Now i make TestLibrary and TestApplication. If i now introspect TestApplication.swf, i see, that MyTestClass has
been included into TestApplication.swf.

If i remove the frame compiler option and make TestApplication again, MyTestClass is no longer included.

Comment actions Permalink

It would be good to discuss it at Adobe's forum or issue tracker. Please post a link to discussion/issue here if you do.

Comment actions Permalink


i have filed a bug at adobes bug tracker:

Comment actions Permalink

Thank you, I voted.

Comment actions Permalink

Will the "include-libraries" option be provided in the next  version?
(An option that tells to compile all classes from swc regardless are are there references to them or not)

Comment actions Permalink

Thanks for the reply, waiting for the next release.


Please sign in to leave a comment.