Maven: The Complete Reference

13.4. The FlexMojos Lifecycle

The FlexMojos Maven plugin customizes the lifecycle based on the packaging. If your project has a packaging of type swc or swf, the FlexMojos plugin with execute a customized lifecycle if your plugin configuration sets the extensions to true. Setting Plugin Extensions to True for Custom Flex Lifecycle shows the plugin configuration for the flexmojos-maven-plugin with the extensions set to true.

Setting Plugin Extensions to True for Custom Flex Lifecycle. 

<build>
    <sourceDirectory>src/main/flex</sourceDirectory>
    <testSourceDirectory>src/test/flex</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.sonatype.flexmojos</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <version>${flexmojos.version}</version>
            *<extensions>true</extensions>*
            <configuration>
                <locales>
                    <locale>en_US</locale>
                </locales>
            </configuration>
        </plugin>
    </plugins>
</build>

13.4.1. The SWC Lifecycle

When the packaging is swc, FlexMojos will execute the lifecycle shown in Figure 13.7, “The FlexMojos SWC Lifecycle”. The highlighted goals are goals from the FlexMojos plugin, the goals which are not highlights are standard goals from the Core Maven plugins.

figs/web/flex-dev_swc-lifecycle.png

Figure 13.7. The FlexMojos SWC Lifecycle


The FlexMojos contributed goals are:

flexmojos:compile-swc
This goal compiles all of the Actionscript and MXML files in the sourceDirectory into a SWC. A SWC is an Adobe library or class file which contains components and resources used in Flex applications.
flexmojos:test-compile
This goal compiles all of the Actionscript and MXML files in the testSourceDirectory.
flexmojos:test-run
This goal executes unit tests using the Flash Player. This goal can only run if the Flash Player has been configured as described in Section 13.2.3, “Configuring Environment to Support Flex Unit Tests”.

13.4.2. The SWF Lifecycle

When the packaging is swf, FlexMojos will execute the lifecycle shown in Figure 13.8, “The FlexMojos SWF Lifecycle”. The highlighted goals are goals from the FlexMojos plugin, the goals which are not highlights are standard goals from the Core Maven plugins.

figs/web/flex-dev_swf-lifecycle.png

Figure 13.8. The FlexMojos SWF Lifecycle


The FlexMojos contributed goals are:

flexmojos:compile-swf
This goal compiles all of the Actionscript and MXML files in the sourceDirectory into a SWF. A SWF is a file which contains an application that can be render by the Adobe Flash Player or Adobe AIR software.
flexmojos:test-compile
This goal compiles all of the Actionscript and MXML files in the testSourceDirectory.
flexmojos:test-run
This goal executes unit tests using the Flash Player. This goal can only run if the Flash Player has been configured as described in Section 13.2.3, “Configuring Environment to Support Flex Unit Tests”.