Tips & Tricks

Flex SDK Sources and Flexmojos Projects

If you are working with Flexmojos Maven projects in IntelliJ IDEA 9, and have imported Flexmojos project as described in this post, and are planning to debug your application and browse through Flex SDK sources, this post is a must-read for you. Inside you will find details on how to configure IntelliJ IDEA so that it properly recognizes SDK sources and their ASdocs.

When IntelliJ IDEA imports a Maven project, it creates a bunch of module libraries that match pom dependencies. For each library it also configures sources and documentation, assuming that they are located in *-source.jar and *-asdoc.zip respectively. Unless you have these files in your local Maven repository, you’ll see them marked with red (see Projects Structure dialog (Ctrl+Alt+Shift+S), Libraries section).

If there is a remote Maven repository containing these files, you can download them via Maven tool window.

For example, standard Flexmojos repository contains *-sources.jar files for the latest Flex SDK distributions (3.5.0.12683 and 4.0.0.12575): http://repository.sonatype.org/content/groups/flexgroup/, which is enough both for debugging code and viewing documentation, because IntelliJ IDEA automatically picks up ASdoc from sources.

If remote repository does not contain Flex SDK sources, you can set them up them manually, but consider that you’ll have to do a lot of routine work yourself — SDK sources should be individually configured for each module library. You may download a standard Flex SDK installation and keep it somewhere on your computer, and then add source folders to Maven libraries according to the following table.

Flex Library Source Folder
com.adobe.flex.framework:framework:swc [Flex SDK]/frameworks/projects/framework/src/
com.adobe.flex.framework:flex:swc [Flex SDK]/frameworks/projects/flex/src/
com.adobe.flex.framework:rpc:swc [Flex SDK]/frameworks/projects/rpc/src/
com.adobe.flex.framework:utilities [Flex SDK]/frameworks/projects/utilities/src/
com.adobe.flex.framework:osmf:swc [Flex SDK]/frameworks/projects/osmf/src/
com.adobe.flex.framework:spark:swc [Flex SDK]/frameworks/projects/spark/src/
com.adobe.flex.framework:sparkskins:swc [Flex SDK]/frameworks/projects/sparkskins/src/
com.adobe.flex.framework:textLayout:swc [Flex SDK]/frameworks/projects/textLayout/src/

Note that AIR-related libraries have similar source structure and locations.

image description