The Maven Flex Plugin generates SWC, SWF using the Flex Compiler API. The following examples describe the basic usage of the Plugin.
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.
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
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.
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 .
The Maven Flex Plugin supports a large number of configuration parameters (as does the underlying Flex Compiler API). See the goals section for more.