Importing Flexmojos Projects to IntelliJ IDEA 8.1.3

IntelliJ IDEA 8.1.3 includes initial support for importing Flex projects that are set up using Flexmojos Maven plugin.

To start the import we need to have a compilable Flexmojos project that generates Flex compiler configuration file during compilation. Let’s take a Flexmojos application sample from the book Maven: The Definitive Guide, chapter 17 Developing with Flexmojos,  section 17.3.2. Creating a Flex Application.

  • Generate a Flexmojos project from the archetype as described in the book.
  • Configure it. IntelliJ IDEA will need a Flex compiler configuration file so we have to configure Flexmojos to save a configuration report. Debugging capabilities may also be configured if required. To achieve it we change project configuration a little bit (edit pom.xml file, added lines are highlighted with bold font):
  • Compile project using Maven (just type mvn compile in the command line): target directory is then generated. It contains compiled *.swf file, *-config-report.xml file and auxilary files in the classes sub-directory.

    We are ready to import the project to IntelliJ IDEA. The easiest way for that is to open pom.xml as if it was a native IntelliJ IDEA project file — click Open Project on the File menu and select this pom.xml.

    In order highlighting, completion and other coding assistance features to work properly, IntelliJ IDEA needs a configured Flex SDK. So, you must download an SDK of the same version that is used by Flexmojos compiler ( by default), add Flex SDK in the JDKs section of Project Structure dialog (Ctrl+Alt+Shift+S), and then set this SDK for the Flex facet that has been automatically created during import of Maven pom.xml.

    Note that configuration report created by Flexmojos is used in IntelliJ IDEA as a custom compiler configuration file. That’s why clicking Make Project, or pressing Ctrl+F9 creates sample-application-1.0-SNAPSHOT.swf file in the same way as Flexmojos compiler does.

    Now you can edit, compile, run and debug your Flex application right from IntelliJ IDEA.

    P.S. Flexmojos support is under active development for IntelliJ IDEA 9 (Maia) and is getting smarter and easier, so keep in touch with the latest EAP builds to see new and improved features.

Comments below can no longer be edited.

2 Responses to Importing Flexmojos Projects to IntelliJ IDEA 8.1.3

  1. Avatar

    Jim Cook says:

    August 27, 2009

    Interesting that Maia #10666 expands on this by auto-generating a Flex SDK based on the packages specified in the Flex-Mojos portion of the Maven build. This raises some issues in my mind because the Maven Flex packages do not include binaries (adl or flashplayer), so how will an Air app be launched or debugged from within the IDE?

    Flex-Mojos relies on the flashplayer to be on the system path or specified in configuration, but it is only used for unit tests. Not sure if there is Air support yet in Flex-Mojos for unit testing.

  2. Avatar

    Alexander Doroshko says:

    August 27, 2009

    Indeed, to work with AIR user needs to have adl binaries and AIR framework on the computer and to give IDEA knowledge about their location. I think we’ll make it configurable in AIR run configuration.

Discover more