Flex & Maven in IntelliJ IDEA
Join the DZone community and get the full member experience.Join For Free
While importing Maven modules with swf or swc packaging type, IntelliJ IDEA creates IntelliJ IDEA module with Flex facet, and attaches Maven dependencies as project libraries. The parameters of Flex facet are taken from pom.xml, where possible.
There is a number of Maven plugins that allow to compile flex applications. They are supported by IntelliJ IDEA in a varying degree. Among them we recommend to take note of the org.sonatype.flexmojos:flexmojos-maven-plugin that is supported at the maximum level since version 3.2. With this plugin you can be sure that all the plugin configuration parameters you specified in the pom.xml, like locales, paths, etc., will be taken into account in the flex facet.
There is only one tiny thing you need to bother about. Do not forget to specify <configurationReport> true </configurationReport> parameter in the flexmojos-Maven-plugin configuration in your pom. This option makes plugin generate the flex compiler configuration file during the 'compile' phase. This file can be used as custom compiler configuration file by Flex facet.
Now, suppose we import such Maven project into IntelliJ IDEA. Let’s take a look on the project structure.
IntelliJ IDEA automatically detects Flex facets, and if there are runtimeLocales, additional Flex facets are configured for each locale. Moreover, when such project is compiled by IntelliJ IDEA, supplementary swc/swf files (depending on the flex project type) are created for each locale.
By default, as we use Maven to create flex config, IntelliJ IDEA uses custom compiler configuration file. The path to this file is also generated automatically based on our pom.xml, and the config itself is generated when you first run Maven “compile” goal.
Opinions expressed by DZone contributors are their own.