Compiling modules

Module properties

Sometimes when developing a Flex application you need to use separate modules then compile them. A module can be defined by 4 properties:

  • name : this is the only mandatory parameter. It represents the name of the module file. By default it is an mxml file.
  • optimizeForApplication : define whether the module will be optimized for the application or not. By default, this value is set to true.
  • moduleFile : it contains the full path to the module. By default modules are placed in the main project folder. If you may use an ActionScript module instead of an MXML one, you should use this property. You can also use it to define the module location.
  • destinationDirectory : currently Flex Builder always builds modules in the following folder bin-debug/package-of-your-module/. Only the swf name can be defined. The Flex Plugin do so. You can define another folder where the compiled module will be placed. If this value is not defined the module will be copied to the default output folder.

Declaring modules in the POM

Modules can be defined inside the configuration tag.

<configuration>
    <modules>
        <module>
            <name>moduleName</groupId>
            <optimizeForApplication>true</artifactId>
            <moduleFile>src/main/flex/modules/administrationModules/moduleFile.as</sourcePath>
            <destinationDirectory>target/modules/administrationModules</sourcePath>
        </module>
    </modules>
<configuration>