Thursday, September 4, 2008

Flex Libraries - SWC and Maven

Handling these dependencies in maven, is just like any other library or jar. For example I'm using mate in my project ,

mvn install:install-file -DgroupId=com.asfusion.mate -DartifactId=mate -Dversion=0.7.8 -Dpackaging=swc -Dfile=<file path>Mate_07_8.swc

and now just add the dependency in your pom file ,


<dependency>
<groupId>com.asfusion.mate</groupId>
<artifactId>mate</artifactId>
<version>0.7.8</version>
<type>swc</type>
</dependency>



for more information refer to this post Adding Libraries to Compilation by velos from the flex-mojos blog

Monday, September 1, 2008

flex-mojos - getting started

What is flex-mojos?

A collection of maven plugins to allow maven to compile, optimize, test and ... Flex SWF, Flex SWC, Air SWF and Air SWC.The main goal is to provide a full support to all mxmlc/compc options. Also here is post from the author on why he wrote it. Flex Mojos Why

First we want to add the flex dependencies to maven to our local repository, or your remote repository. Download the flex sdk from here - Flex 3 SDK . Follow the instructions here Install Adob SDK Mojo .

In the root project add the flex mojos repository



<repositories>
<repository>
<id>flex-mojos-repository</id>
<url>http://svn.sonatype.org/flexmojos/repository/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>


Now we want to add pluginRepository next which is identical to repository



<pluginRepositories>
<pluginRepository>
<id>flex-mojos-repository</id>
<url>
http://svn.sonatype.org/flexmojos/repository/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>


under build we add plugins - plugin



<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
</plugin>
</plugins>
</pluginManagement>
</build>


Now in the flex module under dependency all that is needed to handle all flex dependencies is this :




<dependencies>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>3.0.3.2490</version>
<type>pom</type>
</dependency>
</dependencie



Now under build of the pom ..

<build>
<sourceDirectory>src/main/flex/</sourceDirectory>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>info.flex-mojos</groupId>
<artifactId>flex-compiler-mojo</artifactId>
<version>2.0M5</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>3.0.3.2490</version>
<type>pom</type>
</dependency>
</dependencies>
<configuration>
<locales>
<param>en_US</param>
</locales>
</configuration>
</plugin>
</plugins>
</build>



Thats it...

Anytime you want to upgrade to a newer version of the sdk , just install and change version numbers. Super simple.

run mvn install , and everything should be good.