Usage

The Maven Flex Plugin generates SWC, SWF using the Flex Compiler API. The following examples describe the basic usage of the Plugin.

Accessing the basic Flex dependencies

Flex SDK is not currently distributed on Maven public repositories, such as iBiblio. To access the libraries required to build Flex artifacts, please check this section.

Using the plugin to build an ActionScript library

To build an ActionScript library, you must configure your pom as follows :

<project>
    ...
    <packaging>swc</packaging>
    ...
    <build>
    ...
        <plugins>
            <plugin>
                <groupId>org.servebox.flex</groupId>
                <artifactId>flex-plugin</artifactId>
                <extensions>true</extensions>
                <inherited>true</inherited>
            </plugin>
        </plugins>
    ...
    </build>
    ...
    <dependencies>
        <dependency>
            <groupId>com.adobe.flash.core</groupId>
            <artifactId>playerglobal</artifactId>
            <version>2.0</version>
            <type>swc</type>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    ...
</project>

Notice that the only dependency needed to build a simple ActionScript library (i.e. a library that only uses built-in classes defined by the Flash Player) is playerglobal . The scope attribute allows the compiler to link those built-in classes at compile-time, but avoid the compiler to embed the playerglobal contents into the library.

You can now build your artifact using :

mvn clean flex:makeswc

or

mvn clean package

Installing or deploying artifacts to repositories

To build and install a SWC or SWF artifact to your local repository, simply run :

mvn clean install

To build and deploy a SWC or SWF artifact to a remote repository, simply run :

mvn clean deploy

The deploy goal uses your distributionManagement settings to deploy the artifact.

Using Maven Flex Plugin to run unit tests

The Maven Flex Plugin allow developers to run unit tests, based on the open source project FlexUnit.

For more information about the FlexUnit library, please check the FlexUnit wiki .

Configuration

The Maven Flex Plugin supports a large number of configuration parameters (as does the underlying Flex Compiler API). See the goals section for more.